Tutorial
Example 1: Email Summary
For this example we will use gmail as an email service
- Objective: Create a summary of your e-mails
- Parameter:
value
(desired quantity of e-mails),login
(your e-mail) - Usage Example: User provides a location and receive local weather information
Request
Firstly, you need to create a password for less secure apps by following the link: https://support.google.com/a/answer/6260879?hl=en. With the password created, we can make the first request to extract the email, password and number of emails that will be summarized.
Let’s store this password in a variable, separate from the instruction for LLM
In the example above we have some fields defined in the json, such as Model, functions, function_call and messages.
- Model: Models are responsible for interpreting and generating natural language or code for their function.
- Functions: Field where you can define one or more functions that will be responsible for generating the desired result.
- Function_call: Field responsible for calling the desired function.
- Messages: Return from processing
In the function defined within functions, we have the fields:
- Name: Which defines the name of the function
- Description: Where we provide a function description for the model
- Parameters: Where we define which parameters we want to extract from the function. Still within parameters, we define that it will be of type object and will have three properties, one of type string, login, and value of type integer
- Required: Which of the parameters are mandatory
Response
Processing extracted data
So, after extracting the information, we need to access the email sent, for this it will be necessary to use a function to read and retrieve the desired emails
Since the Llama cannot access your emails, it is necessary to build a function that can access and read your emails. To do this, you need the password for less secure apps, in the case of g-mail.
Email reading result
With the email in hand, we send it again to Llamma, this way it can be interpreted by the model, thus generating the response requested in the function, in example: a summary of the email
Response
Example 2: Event on the calendar
In this second example we will create an event on the calendar, its operation is very similar to the example above.
As in the first example, Llama does not access your email, so we extract the necessary information to be able to send it
Data extraction result
Once we extract the information, we can move it to the function that will be responsible for accessing the email and sending the invitation.
In the example above we created an event in the .ics format, as it is a universal event format it is compatible with most calendar programs, after that we add it to the calendar and send it via SMTP to the recipient