You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+68-61
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@ Function-calling with Python and ollama. We are going to use the Africa's Talkin
6
6
7
7
NB: The phone numbers are placeholders for the actual phone numbers.
8
8
You need some VRAM to run this project. You can get VRAM from [here](https://vast.ai/)
9
-
We recommend 400MB-8GB of VRAM for this project. It can run on CPU however, I recommend smaller models for this.
9
+
We recommend 400MB-8GB of VRAM for this project. It can run on CPU however, I recommend smaller models for this.
10
10
11
-
[Mistral 7B](https://ollama.com/library/mistral), **llama 3.2 3B/1B**, [**Qwen 2.5: 0.5/1.5B**](https://ollama.com/library/qwen2.5:1.5b), [nemotron-mini 4b](https://ollama.com/library/nemotron-mini) and [llama3.1 8B](https://ollama.com/library/llama3.1) are the recommended models for this project.
11
+
[Mistral 7B](https://ollama.com/library/mistral), **llama 3.2 3B/1B**, [**Qwen 2.5: 0.5/1.5B**](https://ollama.com/library/qwen2.5:1.5b), [nemotron-mini 4b](https://ollama.com/library/nemotron-mini) and [llama3.1 8B](https://ollama.com/library/llama3.1) are the recommended models for this project.
12
12
13
-
Ensure ollama is installed on your laptop/server and running before running this project. You can install ollama from [here](ollama.com)
13
+
Ensure ollama is installed on your laptop/server and running before running this project. You can install ollama from [here](ollama.com)
14
14
Learn more about tool calling <https://gorilla.cs.berkeley.edu/leaderboard.html>
15
15
16
16
@@ -22,41 +22,41 @@ Learn more about tool calling <https://gorilla.cs.berkeley.edu/leaderboard.html>
22
22
-[Usage](#usage)
23
23
-[Use cases](#use-cases)
24
24
-[Responsible AI Practices](#responsible-ai-practices)
25
-
-[Limitations](#limitations)
25
+
-[Limitations](#limitations)
26
26
-[Contributing](#contributing)
27
-
-[License](#license)
27
+
-[License](#license)
28
28
29
29
30
30
## File structure
31
-
.
32
-
├── Dockerfile.app - template to run the gradio dashboard.
33
-
├── Dockerfile.ollama - template to run the ollama server.
34
-
├── docker-compose.yml - use the ollama project and gradio dashboard.
35
-
├── docker-compose-codecarbon.yml - use the codecarbon project, ollama and gradio dashboard.
36
-
├── .env - This file contains the environment variables for the project. (Not included in the repository)
37
-
├── app.py - the function_call.py using gradio as the User Interface.
38
-
├── Makefile - This file contains the commands to run the project.
39
-
├── README.md - This file contains the project documentation. This is the file you are currently reading.
40
-
├── requirements.txt - This file contains the dependencies for the project.
41
-
├── summary.png - How function calling works with a diagram.
42
-
├── tests - This directory contains the test files for the project.
43
-
│ ├── __init__.py - This file initializes the tests directory as a package.
44
-
│ ├── test_cases.py - This file contains the test cases for the project.
45
-
│ └── test_run.py - This file contains the code to run the test cases for the function calling LLM.
46
-
└── utils - This directory contains the utility files for the project.
47
-
├── __init__.py - This file initializes the utils directory as a package.
48
-
├── function_call.py - This file contains the code to call a function using LLMs.
49
-
└── communication_apis.py - This file contains the code to do with communication apis & experiments.
31
+
.
32
+
├── Dockerfile.app - template to run the gradio dashboard.
33
+
├── Dockerfile.ollama - template to run the ollama server.
34
+
├── docker-compose.yml - use the ollama project and gradio dashboard.
35
+
├── docker-compose-codecarbon.yml - use the codecarbon project, ollama and gradio dashboard.
36
+
├── .env - This file contains the environment variables for the project. (Not included in the repository)
37
+
├── app.py - the function_call.py using gradio as the User Interface.
38
+
├── Makefile - This file contains the commands to run the project.
39
+
├── README.md - This file contains the project documentation. This is the file you are currently reading.
40
+
├── requirements.txt - This file contains the dependencies for the project.
41
+
├── summary.png - How function calling works with a diagram.
42
+
├── tests - This directory contains the test files for the project.
43
+
│ ├── __init__.py - This file initializes the tests directory as a package.
44
+
│ ├── test_cases.py - This file contains the test cases for the project.
45
+
│ └── test_run.py - This file contains the code to run the test cases for the function calling LLM.
46
+
└── utils - This directory contains the utility files for the project.
47
+
├── __init__.py - This file initializes the utils directory as a package.
48
+
├── function_call.py - This file contains the code to call a function using LLMs.
49
+
└── communication_apis.py - This file contains the code to do with communication apis & experiments.
50
50
51
51
### attribution
52
-
This project uses the Qwen2.5-0.5B model developed by Alibaba Cloud under the Apache License 2.0. The original project can be found at [Qwen technical report](https://arxiv.org/abs/2412.15115)
52
+
This project uses the Qwen2.5-0.5B model developed by Alibaba Cloud under the Apache License 2.0. The original project can be found at [Qwen technical report](https://arxiv.org/abs/2412.15115)
53
53
54
54
### License
55
55
56
56
This project is licensed under the Apache License 2.0. See the [LICENSE](./LICENSE) file for more details.
57
-
57
+
58
58
## Installation
59
-
The project uses python 3.12. To install the project, follow the steps below:
59
+
The project uses python 3.12. To install the project, follow the steps below:
- The Dockerfile creates 2 images for the ollama server and the gradio dashboard. The ollama server is running on port 11434 and the gradio dashboard is running on port 7860 . You can access the gradio dashboard by visiting <http://localhost:7860> in your browser & the ollama server by visiting <http://localhost:11434> in your browser. They consume about 2.72GB of storage in the container.
135
+
- The Dockerfile creates 2 images for the ollama server and the gradio dashboard. The ollama server is running on port 11434 and the gradio dashboard is running on port 7860 . You can access the gradio dashboard by visiting <http://localhost:7860> in your browser & the ollama server by visiting <http://localhost:11434> in your browser. They consume about 2.72GB of storage in the container.
135
136
- The docker-compose.yml file is used to run the ollama server and the gradio dashboard. The docker-compose-codecarbon.yml file is used to run the ollama server, the gradio dashboard and the codecarbon project.
136
-
- You can learn more about how to make this system even more secure. Do this [course](https://www.kaggle.com/learn-guide/5-day-genai#GenAI).
137
+
- You can learn more about how to make this system even more secure. Do this [course](https://www.kaggle.com/learn-guide/5-day-genai#GenAI).
137
138
138
139
139
140
## Run in runpod.io
140
-
Make an account if you haven't already. Once that's settled.
141
+
Make an account if you haven't already. Once that's settled.
141
142
142
-
- Click on Deploy under Pods.
143
-
- Select the cheapest option pod to deploy for example RTX 2000 Ada.
144
-
- This will create a jupyter lab instance.
145
-
- Follow the Installation steps in the terminal available. Until the make install.
146
-
- Run this command. Install ollama and serve it then redirect output to a log file.
143
+
- Click on Deploy under Pods.
144
+
- Select the cheapest option pod to deploy for example RTX 2000 Ada.
145
+
- This will create a jupyter lab instance.
146
+
- Follow the Installation steps in the terminal available. Until the make install.
147
+
- Run this command. Install ollama and serve it then redirect output to a log file.
- Install your preferred model in the same terminal.
152
+
- Install your preferred model in the same terminal.
152
153
153
154
```bash
154
155
ollama run qwen2.5:0.5b
155
156
```
156
-
- Export your credentials but, if you are using a .env file, you can skip this step. It will be useful for Docker.
157
+
- Export your credentials but, if you are using a .env file, you can skip this step. It will be useful for Docker.
157
158
158
159
```bash
159
160
export AT_API_KEY=yourapikey
160
161
export AT_USERNAME=yourusername
162
+
export GROQ_API_KEY=yourgroqapikey
161
163
export LANGTRACE_API_KEY=yourlangtraceapikey
162
164
export TEST_PHONE_NUMBER=yourphonenumber
163
165
export TEST_PHONE_NUMBER_2=yourphonenumber
164
166
export TEST_PHONE_NUMBER_3=yourphonenumber
165
167
```
166
-
- Continue running the installation steps in the terminal.
167
-
- Send your first message and airtime with an LLM. 🌠
168
+
- Continue running the installation steps in the terminal.
169
+
- Send your first message and airtime with an LLM. 🌠
168
170
169
-
Read more about setting up ollama and serveless options <https://blog.runpod.io/run-llama-3-1-405b-with-ollama-a-step-by-step-guide/> & <https://blog.runpod.io/run-llama-3-1-with-vllm-on-runpod-serverless/>
171
+
Read more about setting up ollama and serveless options <https://blog.runpod.io/run-llama-3-1-405b-with-ollama-a-step-by-step-guide/> & <https://blog.runpod.io/run-llama-3-1-with-vllm-on-runpod-serverless/>
170
172
171
173
## Usage
172
-
This project uses LLMs to send airtime to a phone number. The difference is that we are going to use the Africa's Talking API to send airtime to a phone number using Natural language. Here are examples of prompts you can use to send airtime to a phone number:
173
-
- Send airtime to xxxxxxxxxx046 and xxxxxxxxxx524 with an amount of 10 in currency KES.
174
+
This project uses LLMs to send airtime to a phone number. The difference is that we are going to use the Africa's Talking API to send airtime to a phone number using Natural language. Here are examples of prompts you can use to send airtime to a phone number:
175
+
- Send airtime to xxxxxxxxxx046 and xxxxxxxxxx524 with an amount of 10 in currency KES.
174
176
- Send a message to xxxxxxxxxx046 and xxxxxxxxxx524 with a message "Hello, how are you?", using the username "username".
175
177
178
+
## Updated Usage Instructions
179
+
- The app now supports both Text and Voice input tabs.
180
+
- In the Voice Input tab, record audio and click "Transcribe" to preview the transcription. Then click "Process Edited Text" to execute voice commands.
181
+
- In the Text Input tab, directly type commands to send airtime or messages or to search news.
182
+
176
183
### Responsible AI Practices
177
-
This project implements several responsible AI practices:
178
-
- All test data is anonymized to protect privacy.
179
-
- Input validation to prevent misuse (negative amounts, spam detection).
180
-
- Handling of sensitive content and edge cases.
181
-
- Comprehensive test coverage for various scenarios.
182
-
- Secure handling of credentials and personal information.
184
+
This project implements several responsible AI practices:
185
+
- All test data is anonymized to protect privacy.
186
+
- Input validation to prevent misuse (negative amounts, spam detection).
187
+
- Handling of sensitive content and edge cases.
188
+
- Comprehensive test coverage for various scenarios.
189
+
- Secure handling of credentials and personal information.
183
190
184
191

185
192
186
193
## Use cases
187
-
* Non-Technical User Interfaces: Simplifies the process for non-coders to interact with APIs, making it easier for them to send airtime and messages without needing to understand the underlying code.
188
-
* Customer Support Automation: Enables customer support teams to quickly send airtime or messages to clients using natural language commands, improving efficiency and response times.
189
-
* Marketing Campaigns: Facilitates the automation of promotional messages and airtime rewards to customers, enhancing engagement and retention.
190
-
* Emergency Notifications: Allows rapid dissemination of urgent alerts and notifications to a large number of recipients using simple prompts.
191
-
* Educational Tools: Provides a practical example for teaching how to integrate APIs with natural language processing, which can be beneficial for coding bootcamps and workshops.
192
-
* Multilingual Support: Supports multiple languages when sending messages and airtime, making it accessible to a diverse range of users. Testing for Arabic, French, English and Portuguese.
194
+
* Non-Technical User Interfaces: Simplifies the process for non-coders to interact with APIs, making it easier for them to send airtime and messages without needing to understand the underlying code.
195
+
* Customer Support Automation: Enables customer support teams to quickly send airtime or messages to clients using natural language commands, improving efficiency and response times.
196
+
* Marketing Campaigns: Facilitates the automation of promotional messages and airtime rewards to customers, enhancing engagement and retention.
197
+
* Emergency Notifications: Allows rapid dissemination of urgent alerts and notifications to a large number of recipients using simple prompts.
198
+
* Educational Tools: Provides a practical example for teaching how to integrate APIs with natural language processing, which can be beneficial for coding bootcamps and workshops.
199
+
* Multilingual Support: Supports multiple languages when sending messages and airtime, making it accessible to a diverse range of users. Testing for Arabic, French, English and Portuguese.
193
200
194
201
## Limitations
195
-
- The project is limited to sending airtime, searching for news, and messages using the Africa's Talking API. The functionality can be expanded to include other APIs and services.
202
+
- The project is limited to sending airtime, searching for news, and messages using the Africa's Talking API. The functionality can be expanded to include other APIs and services.
196
203
197
-
- The jailbreaking of the LLMS is a limitation. The LLMS are not perfect and can be manipulated to produce harmful outputs. This can be mitigated by using a secure environment and monitoring the outputs for any malicious content. However, the Best of N technique and prefix injection were effective in changing model behavior.
204
+
- The jailbreaking of the LLMS is a limitation. The LLMS are not perfect and can be manipulated to produce harmful outputs. This can be mitigated by using a secure environment and monitoring the outputs for any malicious content. However, the Best of N technique and prefix injection were effective in changing model behavior.
198
205
199
-
- A small number of test cases were used to test the project. More test cases can be added to cover a wider range of scenarios and edge cases.
206
+
- A small number of test cases were used to test the project. More test cases can be added to cover a wider range of scenarios and edge cases.
200
207
201
208
## Contributing
202
209
Contributions are welcome. If you would like to contribute to the project, you can fork the repository, create a new branch, make your changes and then create a pull request.
0 commit comments