Dagger
Search

financialadvisor

This module orchestrates a series of Dagger methods to provide personalized financial advice based on the user's bank transactions. By integrating various services, including spreadsheet data fetching, transaction filtering, expense categorization, MongoDB interaction, and AI-driven advice generation, this module delivers actionable insights to users via SMS.

Functions:
run_pipeline
This function runs a pipeline that processes bank transaction data to generate financial advice using AI, then sends this advice to the user via SMS.

Args:

apiKey (Secret): A Secret object storing the API key for accessing the spreadsheet containing transaction data.
sheet (Secret): A Secret object storing the identifier of the spreadsheet to be accessed.
connection (Secret): A Secret object storing the MongoDB connection string for database access.
hftoken (Secret): A Secret object storing the Hugging Face API token for categorizing expenses.
openai (Secret): A Secret object storing the OpenAI API key for generating financial advice.
textBelt (Secret): A Secret object storing the TextBelt API key for sending SMS messages.
mobileNums (str): A comma-separated string of mobile numbers to send the financial advice to.
database (str): The name of the MongoDB database to interact with.
collection (str): The name of the MongoDB collection to interact with.

Returns:

A string indicating the success or failure of the SMS sending process.

Example Use Case:

dagger call run_pipeline --apiKey=env:API_KEY --sheet=env:SHEET_ID --connection=env:DB_CONNECTION --hftoken=env:HF_TOKEN --openai=env:OPENAI_SECRET --textBelt=env:TEXTBELT_KEY --mobileNums=' 1234567890, 0987654321' --database='financial_data' --collection='transactions'

This command fetches the latest transaction data, filters for new transactions, categorizes expenses, writes categorized transactions to MongoDB, retrieves data for advice generation, generates advice using AI, and sends the advice via SMS.

Function - send:
This function sends the generated financial advice as an SMS to multiple recipients using the TextBelt service.

Args:

encoded_message (str): The URL-encoded financial advice message to be sent.
mobile (str): A comma-separated string of mobile numbers to send the message to.
textBelt (Secret): A Secret object storing the TextBelt API key for sending SMS messages.

Returns:

A string indicating the result of the SMS sending process.

Example Use Case:

dagger call send --encoded_message='Your financial advice here' --mobile=' 1234567890, 0987654321' --textBelt=env:TEXTBELT_KEY

This command sends the provided financial advice to the specified mobile numbers using the TextBelt API.

Technical Details
The `run_pipeline` function follows a multi-step process:

1. **Fetch Spreadsheet Data**: Retrieves bank transaction data from a specified spreadsheet.
2. **Filter for New Transactions**: Identifies new transactions that haven't been processed before.
3. **Categorize Expenses**: Uses a zero-shot model to categorize the new transactions by spend.
4. **Write to MongoDB**: Stores the categorized transactions in a MongoDB collection.
5. **Retrieve Data for Advice Generation**: Fetches data from MongoDB to be used for generating financial advice.
6. **Generate Financial Advice**: Utilizes OpenAI's GPT models to generate personalized financial advice based on the retrieved data.
7. **Send Advice via SMS**: Sends the generated advice to the user's mobile numbers using the TextBelt service.

The `send` function iterates through the list of provided mobile numbers and uses a CURL command within a Docker container to send the SMS messages.

This module aims to streamline the process of obtaining and delivering AI-driven financial advice, making it a valuable tool for personal finance management and advisory services.

Installation

dagger install github.com/EmmS21/financialadvisor@667f3e02c061c44334342009abcf819f24635b6f

Entrypoint

Return Type
Financialadvisor !
Example
dagger -m github.com/EmmS21/financialadvisor@667f3e02c061c44334342009abcf819f24635b6f call \
func (m *myModule) example() *Financialadvisor  {
	return dag.
			Financialadvisor()
}
@function
def example() -> dag.Financialadvisor:
	return (
		dag.financialadvisor()
	)
@func()
example(): Financialadvisor {
	return dag
		.financialadvisor()
}

Types

Financialadvisor 🔗

runPipeline() 🔗

Returns a container that echoes whatever string argument is provided

Return Type
String !
Arguments
NameTypeDefault ValueDescription
apiKeySecret !-A reference to a secret value, which can be handled more safely than the value itself.
sheetSecret !-A reference to a secret value, which can be handled more safely than the value itself.
connectionSecret !-A reference to a secret value, which can be handled more safely than the value itself.
hftokenSecret !-A reference to a secret value, which can be handled more safely than the value itself.
openaiSecret !-A reference to a secret value, which can be handled more safely than the value itself.
textBeltSecret !-A reference to a secret value, which can be handled more safely than the value itself.
databaseString !-No description provided
collectionString !-No description provided
Example
dagger -m github.com/EmmS21/financialadvisor@667f3e02c061c44334342009abcf819f24635b6f call \
 run-pipeline --api-key env:MYSECRET --sheet env:MYSECRET --connection env:MYSECRET --hftoken env:MYSECRET --openai env:MYSECRET --text-belt env:MYSECRET --database string --collection string
func (m *myModule) example(ctx context.Context, apiKey *Secret, sheet *Secret, connection *Secret, hftoken *Secret, openai *Secret, textBelt *Secret, database string, collection string) string  {
	return dag.
			Financialadvisor().
			RunPipeline(ctx, apiKey, sheet, connection, hftoken, openai, textBelt, database, collection)
}
@function
async def example(api_key: dagger.Secret, sheet: dagger.Secret, connection: dagger.Secret, hftoken: dagger.Secret, openai: dagger.Secret, text_belt: dagger.Secret, database: str, collection: str) -> str:
	return await (
		dag.financialadvisor()
		.run_pipeline(api_key, sheet, connection, hftoken, openai, text_belt, database, collection)
	)
@func()
async example(apiKey: Secret, sheet: Secret, connection: Secret, hftoken: Secret, openai: Secret, textBelt: Secret, database: string, collection: string): Promise<string> {
	return dag
		.financialadvisor()
		.runPipeline(apiKey, sheet, connection, hftoken, openai, textBelt, database, collection)
}

send() 🔗

Returns lines that match a pattern in the files of the provided Directory

Return Type
String !
Arguments
NameTypeDefault ValueDescription
encodedMessageString !-No description provided
textBeltSecret !-A reference to a secret value, which can be handled more safely than the value itself.
Example
dagger -m github.com/EmmS21/financialadvisor@667f3e02c061c44334342009abcf819f24635b6f call \
 send --encoded-message string --text-belt env:MYSECRET
func (m *myModule) example(ctx context.Context, encodedMessage string, textBelt *Secret) string  {
	return dag.
			Financialadvisor().
			Send(ctx, encodedMessage, textBelt)
}
@function
async def example(encoded_message: str, text_belt: dagger.Secret) -> str:
	return await (
		dag.financialadvisor()
		.send(encoded_message, text_belt)
	)
@func()
async example(encodedMessage: string, textBelt: Secret): Promise<string> {
	return dag
		.financialadvisor()
		.send(encodedMessage, textBelt)
}