bolna 0.6.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. bolna-0.6.3/LICENSE +21 -0
  2. bolna-0.6.3/PKG-INFO +182 -0
  3. bolna-0.6.3/README.md +131 -0
  4. bolna-0.6.3/bolna/__init__.py +1 -0
  5. bolna-0.6.3/bolna/agent_manager/__init__.py +3 -0
  6. bolna-0.6.3/bolna/agent_manager/assistant_manager.py +53 -0
  7. bolna-0.6.3/bolna/agent_manager/base_manager.py +8 -0
  8. bolna-0.6.3/bolna/agent_manager/task_manager.py +614 -0
  9. bolna-0.6.3/bolna/agent_types/__init__.py +4 -0
  10. bolna-0.6.3/bolna/agent_types/base_agent.py +8 -0
  11. bolna-0.6.3/bolna/agent_types/contextual_conversational_agent.py +33 -0
  12. bolna-0.6.3/bolna/agent_types/extraction_agent.py +15 -0
  13. bolna-0.6.3/bolna/agent_types/graph_based_conversational_agent.py +136 -0
  14. bolna-0.6.3/bolna/agent_types/notification_agent.py +14 -0
  15. bolna-0.6.3/bolna/agent_types/summarization_agent.py +22 -0
  16. bolna-0.6.3/bolna/constants.py +29 -0
  17. bolna-0.6.3/bolna/helpers/__init__.py +0 -0
  18. bolna-0.6.3/bolna/helpers/analytics_helpers.py +138 -0
  19. bolna-0.6.3/bolna/helpers/cloudwatch_handler.py +50 -0
  20. bolna-0.6.3/bolna/helpers/logger_config.py +53 -0
  21. bolna-0.6.3/bolna/helpers/utils.py +230 -0
  22. bolna-0.6.3/bolna/input_handlers/__init__.py +2 -0
  23. bolna-0.6.3/bolna/input_handlers/default.py +84 -0
  24. bolna-0.6.3/bolna/input_handlers/twilio.py +102 -0
  25. bolna-0.6.3/bolna/llms/__init__.py +2 -0
  26. bolna-0.6.3/bolna/llms/litellm.py +73 -0
  27. bolna-0.6.3/bolna/llms/llm.py +16 -0
  28. bolna-0.6.3/bolna/llms/openai_llm.py +74 -0
  29. bolna-0.6.3/bolna/models.py +144 -0
  30. bolna-0.6.3/bolna/output_handlers/__init__.py +2 -0
  31. bolna-0.6.3/bolna/output_handlers/default.py +39 -0
  32. bolna-0.6.3/bolna/output_handlers/twilio.py +92 -0
  33. bolna-0.6.3/bolna/prompts.py +31 -0
  34. bolna-0.6.3/bolna/providers.py +30 -0
  35. bolna-0.6.3/bolna/synthesizer/__init__.py +3 -0
  36. bolna-0.6.3/bolna/synthesizer/base_synthesizer.py +10 -0
  37. bolna-0.6.3/bolna/synthesizer/elevenlabs_synthesizer.py +125 -0
  38. bolna-0.6.3/bolna/synthesizer/polly_synthesizer.py +55 -0
  39. bolna-0.6.3/bolna/synthesizer/xtts_synthesizer.py +94 -0
  40. bolna-0.6.3/bolna/transcriber/__init__.py +2 -0
  41. bolna-0.6.3/bolna/transcriber/base_transcriber.py +61 -0
  42. bolna-0.6.3/bolna/transcriber/deepgram_transcriber.py +157 -0
  43. bolna-0.6.3/bolna.egg-info/PKG-INFO +182 -0
  44. bolna-0.6.3/bolna.egg-info/SOURCES.txt +48 -0
  45. bolna-0.6.3/bolna.egg-info/dependency_links.txt +1 -0
  46. bolna-0.6.3/bolna.egg-info/requires.txt +20 -0
  47. bolna-0.6.3/bolna.egg-info/top_level.txt +1 -0
  48. bolna-0.6.3/pyproject.toml +51 -0
  49. bolna-0.6.3/requirements.txt +17 -0
  50. bolna-0.6.3/setup.cfg +4 -0
bolna-0.6.3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Bolna
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
bolna-0.6.3/PKG-INFO ADDED
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.1
2
+ Name: bolna
3
+ Version: 0.6.3
4
+ Author-email: Prateek Sachan <ps@prateeksachan.com>
5
+ License: MIT License
6
+
7
+ Copyright (c) 2023 Bolna
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ Classifier: License :: OSI Approved :: MIT License
27
+ Classifier: Programming Language :: Python
28
+ Classifier: Programming Language :: Python :: 3
29
+ Requires-Python: >=3.8
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: aiobotocore==2.9.0
33
+ Requires-Dist: aiodynamo==23.10.1
34
+ Requires-Dist: aiohttp==3.8.6
35
+ Requires-Dist: fastapi==0.95.1
36
+ Requires-Dist: litellm==1.15.7
37
+ Requires-Dist: numpy==1.26.1
38
+ Requires-Dist: openai==1.3.5
39
+ Requires-Dist: pydantic==1.10.7
40
+ Requires-Dist: python-dateutil==2.8.2
41
+ Requires-Dist: python-dotenv==1.0.0
42
+ Requires-Dist: redis==5.0.1
43
+ Requires-Dist: requests==2.31.0
44
+ Requires-Dist: tiktoken==0.5.2
45
+ Requires-Dist: twilio==8.9.0
46
+ Requires-Dist: uvicorn==0.22.0
47
+ Requires-Dist: uvloop==0.19.0
48
+ Requires-Dist: websockets==10.4
49
+ Provides-Extra: dev
50
+ Requires-Dist: pip-tools; extra == "dev"
51
+
52
+ <h1 align="center">
53
+ </h1>
54
+ <p align="center">
55
+ <p align="center"><b>End-to-end open-source voice agents platform</b>: Quickly build LLM based voice driven conversational applications</p>
56
+ </p>
57
+
58
+ <h4 align="center">
59
+ <a href="https://discord.gg/6fTq2F9s">Discord</a> |
60
+ <a href="https://docs.bolna.dev">Docs</a> |
61
+ <a href="https://bolna.dev">Website</a>
62
+ </h4>
63
+
64
+ <h4 align="center">
65
+ <a href="https://github.com/bolna-ai/bolna/blob/main/LICENSE">
66
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Bolna is released under the MIT license." />
67
+ </a>
68
+ <a href="https://github.com/bolna-ai/bolna/blob/main/CONTRIBUTING.md">
69
+ <img src="https://img.shields.io/badge/PRs-Welcome-brightgreen" alt="PRs welcome!" />
70
+ </a>
71
+ </h4>
72
+
73
+
74
+ ## Introduction
75
+
76
+ **[Bolna](https://bolna.dev)** is the end--to-end open source production ready framework for quickly building LLM based voice driven conversational applications.
77
+
78
+
79
+ ## Demo
80
+ https://github.com/bolna-ai/bolna/assets/1313096/2237f64f-1c5b-4723-b7e7-d11466e9b226
81
+
82
+
83
+
84
+ ## Components
85
+ Bolna helps you create AI Voice Agents which can be instructed to do tasks beginning with:
86
+
87
+ 1. Initiating a phone call using telephony providers like `Twilio`, etc.
88
+ 2. Transcribing the conversations using `Deepgram`, etc.
89
+ 3. Using LLMs like `OpenAI`, etc to handle conversations
90
+ 4. Synthesizing LLM responses back to telephony using `AWS Polly`, `XTTS`, etc.
91
+ 5. Instructing the Agent to perform tasks like sending emails, text messages, booking calendar after the conversation has ended
92
+
93
+ Refer to the [docs](https://docs.bolna.dev) for a deepdive into all supported providers.
94
+
95
+
96
+ ## Agents
97
+ This repo contains the following types of agents in the `agents/agent_types` directory which can be used to create conversational applications:
98
+
99
+ 1. `contextual_conversational_agent`: LLM-based free flow agent
100
+ 2. `graph_based_conversational_agent`: LLM-based agent with classification
101
+ 3. `extraction_agent`: Currently WIP. [Feel free to contribute and open a PR](https://github.com/bolna-ai/bolna/compare)
102
+
103
+
104
+ ## Local setup
105
+ A basic local setup uses Twilio for telephony. We have dockerized the setup in `local_setup/`. One will need to populate an environment `.env` file from `.env.sample`.
106
+
107
+ The setup consists of four containers:
108
+
109
+ 1. Twilio web server: for initiating the calls one will need to set up a [Twilio account](https://www.twilio.com/docs/usage/tutorials/how-to-use-your-free-trial-account)
110
+ 2. Bolna server: for creating and handling agents
111
+ 3. `ngrok`: for tunneling. One will need to add the `authtoken` to `ngrok-config.yml`
112
+ 4. `redis`: for persisting agents & users contextual data
113
+
114
+ Running `docker-compose up --build` will use the `.env` as the environment file and the `agent_data` to start all containers.
115
+
116
+ Once the docker containers are up, you can now start to create your agents and instruct them to initiate calls.
117
+
118
+
119
+ ## Agent Examples
120
+ The repo contains examples as a reference for creating for application agents in the `agent_data` directory:
121
+
122
+ 1. `airbnb_job`: A `streaming` `conversation` agent where the agent screens potential candidates for a job at AirBnB
123
+ 2. `sorting_hat`: A `preprocessed` `conversation` agent which acts as a Sorting Hat for Hogwarts
124
+ 3. `yc_screening`: A `streaming` `conversation` agent which acts as a Y Combinator partner asking questions around the idea/startup
125
+ 4. `indian_elections_vernacular`: A `streaming` `conversation` agent which asks people for their outlook towards Indian elections in Hindi language
126
+ 5. `sample_agent`: A boilerplate sample agent to start building your own agent!
127
+
128
+
129
+ ## Anatomy of an agent
130
+ All agents are read from the `agent_data` directory. We have provided some samples for getting started. There's a dashboard coming up [still in WIP] which will easily facilitate towards creating agents.
131
+
132
+ General structure of the agents:
133
+
134
+ your-awesome-agent-name
135
+ ├── conversation_details.json # Compiled prompt
136
+ └── users.json # List of users that the call would be made to
137
+
138
+ | Agent type | `streaming` agent | `preprocessed` agent |
139
+ |---------------|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
140
+ | Introduction | A streaming agent will work like a free-flow conversation following the prompt | Apart from following the prompt, a preprocessed agent will have all responses <br/>from the agent preprocessed in the form of audio which will be streamed <br/>as per the classification of human's response |
141
+ | Prompt | Required (defined in `conversation_details.json`) | Required (defined in `conversation_details.json`) |
142
+ | Preprocessing | Not required | Required (using `scripts/preprocessed.py`) |
143
+
144
+
145
+ > [!note]
146
+ > Currently, the `users.json` has the following user attributes which gets substituted in the prompt to make it customized for the call. More to be added soon!
147
+ > - first_name
148
+ > - last_name
149
+ > - honorific
150
+ >
151
+ >
152
+ >
153
+ > For instance, in the case of a preprocessed agent, the initial intro could be customized to have the user's name.
154
+ >
155
+ > Even the prompt could be customized to fill in user contextual details from users.json. For example, [{first_name} defined in prompt](https://github.com/bolna-ai/bolna/blob/master/agent_data/airbnb_job/conversation_details.json#L3) and [prompt intro](https://github.com/bolna-ai/bolna/blob/master/agent_data/sorting_hat/conversation_details.json#L10)
156
+
157
+
158
+ ## Setting up your agent
159
+ 1. Create a directory under `agent_data` directory with the name for your agent
160
+ 2. Create your prompt and save in a file called `conversation_details.json` using the example provided
161
+ 3. Optional: In case if you are creating a `preprocessed` agent, generate the audio data used by using the script `scripts/preprocess.py`
162
+
163
+
164
+ ## Creating your agent and invoking calls
165
+ 1. At this point, the docker containers should be up and running
166
+ 2. Your agent prompt should be defined in the `agent_data/` directory with `conversation_details.json` with the user list in `users.json`
167
+ 3. Create your agent using the [Bolna Create Agent API](https://docs.bolna.dev/api-reference/endpoint/create). An agent will get created with an `agent_id`
168
+ 4. Instruct the agent to initiate call to users via `scripts/initiate_agent_call.py <agent_name> <agent_id>`
169
+
170
+
171
+ ## Open-source v/s Paid
172
+ Though the repository is completely open source, you can connect with us if interested in managed offerings or more customized solutions.
173
+
174
+ <a href="https://calendly.com/bolna/30min"><img alt="Schedule a meeting" src="https://cdn.cookielaw.org/logos/122ecfc3-4694-42f1-863f-2db42d1b1e68/0bcbbcf4-9b83-4684-ba59-bc913c0d5905/c21bea90-f4f1-43d1-8118-8938bbb27a9d/logo.png" /></a>
175
+
176
+
177
+ ## Contributing
178
+ We love all types of contributions: whether big or small helping in improving this community resource.
179
+
180
+ 1. There are a number of [open issues present](https://github.com/bolna-ai/bolna/issues) which can be good ones to start with
181
+ 2. If you have suggestions for enhancements, wish to contribute a simple fix such as correcting a typo, or want to address an apparent bug, please feel free to initiate a new issue or submit a pull request
182
+ 2. If you're contemplating a larger change or addition to this repository, be it in terms of its structure or the features, kindly begin by creating a new issue [open a new issue :octocat:](https://github.com/bolna-ai/bolna/issues/new) and outline your proposed changes. This will allow us to engage in a discussion before you dedicate a significant amount of time or effort. Your cooperation and understanding are appreciated
bolna-0.6.3/README.md ADDED
@@ -0,0 +1,131 @@
1
+ <h1 align="center">
2
+ </h1>
3
+ <p align="center">
4
+ <p align="center"><b>End-to-end open-source voice agents platform</b>: Quickly build LLM based voice driven conversational applications</p>
5
+ </p>
6
+
7
+ <h4 align="center">
8
+ <a href="https://discord.gg/6fTq2F9s">Discord</a> |
9
+ <a href="https://docs.bolna.dev">Docs</a> |
10
+ <a href="https://bolna.dev">Website</a>
11
+ </h4>
12
+
13
+ <h4 align="center">
14
+ <a href="https://github.com/bolna-ai/bolna/blob/main/LICENSE">
15
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Bolna is released under the MIT license." />
16
+ </a>
17
+ <a href="https://github.com/bolna-ai/bolna/blob/main/CONTRIBUTING.md">
18
+ <img src="https://img.shields.io/badge/PRs-Welcome-brightgreen" alt="PRs welcome!" />
19
+ </a>
20
+ </h4>
21
+
22
+
23
+ ## Introduction
24
+
25
+ **[Bolna](https://bolna.dev)** is the end--to-end open source production ready framework for quickly building LLM based voice driven conversational applications.
26
+
27
+
28
+ ## Demo
29
+ https://github.com/bolna-ai/bolna/assets/1313096/2237f64f-1c5b-4723-b7e7-d11466e9b226
30
+
31
+
32
+
33
+ ## Components
34
+ Bolna helps you create AI Voice Agents which can be instructed to do tasks beginning with:
35
+
36
+ 1. Initiating a phone call using telephony providers like `Twilio`, etc.
37
+ 2. Transcribing the conversations using `Deepgram`, etc.
38
+ 3. Using LLMs like `OpenAI`, etc to handle conversations
39
+ 4. Synthesizing LLM responses back to telephony using `AWS Polly`, `XTTS`, etc.
40
+ 5. Instructing the Agent to perform tasks like sending emails, text messages, booking calendar after the conversation has ended
41
+
42
+ Refer to the [docs](https://docs.bolna.dev) for a deepdive into all supported providers.
43
+
44
+
45
+ ## Agents
46
+ This repo contains the following types of agents in the `agents/agent_types` directory which can be used to create conversational applications:
47
+
48
+ 1. `contextual_conversational_agent`: LLM-based free flow agent
49
+ 2. `graph_based_conversational_agent`: LLM-based agent with classification
50
+ 3. `extraction_agent`: Currently WIP. [Feel free to contribute and open a PR](https://github.com/bolna-ai/bolna/compare)
51
+
52
+
53
+ ## Local setup
54
+ A basic local setup uses Twilio for telephony. We have dockerized the setup in `local_setup/`. One will need to populate an environment `.env` file from `.env.sample`.
55
+
56
+ The setup consists of four containers:
57
+
58
+ 1. Twilio web server: for initiating the calls one will need to set up a [Twilio account](https://www.twilio.com/docs/usage/tutorials/how-to-use-your-free-trial-account)
59
+ 2. Bolna server: for creating and handling agents
60
+ 3. `ngrok`: for tunneling. One will need to add the `authtoken` to `ngrok-config.yml`
61
+ 4. `redis`: for persisting agents & users contextual data
62
+
63
+ Running `docker-compose up --build` will use the `.env` as the environment file and the `agent_data` to start all containers.
64
+
65
+ Once the docker containers are up, you can now start to create your agents and instruct them to initiate calls.
66
+
67
+
68
+ ## Agent Examples
69
+ The repo contains examples as a reference for creating for application agents in the `agent_data` directory:
70
+
71
+ 1. `airbnb_job`: A `streaming` `conversation` agent where the agent screens potential candidates for a job at AirBnB
72
+ 2. `sorting_hat`: A `preprocessed` `conversation` agent which acts as a Sorting Hat for Hogwarts
73
+ 3. `yc_screening`: A `streaming` `conversation` agent which acts as a Y Combinator partner asking questions around the idea/startup
74
+ 4. `indian_elections_vernacular`: A `streaming` `conversation` agent which asks people for their outlook towards Indian elections in Hindi language
75
+ 5. `sample_agent`: A boilerplate sample agent to start building your own agent!
76
+
77
+
78
+ ## Anatomy of an agent
79
+ All agents are read from the `agent_data` directory. We have provided some samples for getting started. There's a dashboard coming up [still in WIP] which will easily facilitate towards creating agents.
80
+
81
+ General structure of the agents:
82
+
83
+ your-awesome-agent-name
84
+ ├── conversation_details.json # Compiled prompt
85
+ └── users.json # List of users that the call would be made to
86
+
87
+ | Agent type | `streaming` agent | `preprocessed` agent |
88
+ |---------------|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
89
+ | Introduction | A streaming agent will work like a free-flow conversation following the prompt | Apart from following the prompt, a preprocessed agent will have all responses <br/>from the agent preprocessed in the form of audio which will be streamed <br/>as per the classification of human's response |
90
+ | Prompt | Required (defined in `conversation_details.json`) | Required (defined in `conversation_details.json`) |
91
+ | Preprocessing | Not required | Required (using `scripts/preprocessed.py`) |
92
+
93
+
94
+ > [!note]
95
+ > Currently, the `users.json` has the following user attributes which gets substituted in the prompt to make it customized for the call. More to be added soon!
96
+ > - first_name
97
+ > - last_name
98
+ > - honorific
99
+ >
100
+ >
101
+ >
102
+ > For instance, in the case of a preprocessed agent, the initial intro could be customized to have the user's name.
103
+ >
104
+ > Even the prompt could be customized to fill in user contextual details from users.json. For example, [{first_name} defined in prompt](https://github.com/bolna-ai/bolna/blob/master/agent_data/airbnb_job/conversation_details.json#L3) and [prompt intro](https://github.com/bolna-ai/bolna/blob/master/agent_data/sorting_hat/conversation_details.json#L10)
105
+
106
+
107
+ ## Setting up your agent
108
+ 1. Create a directory under `agent_data` directory with the name for your agent
109
+ 2. Create your prompt and save in a file called `conversation_details.json` using the example provided
110
+ 3. Optional: In case if you are creating a `preprocessed` agent, generate the audio data used by using the script `scripts/preprocess.py`
111
+
112
+
113
+ ## Creating your agent and invoking calls
114
+ 1. At this point, the docker containers should be up and running
115
+ 2. Your agent prompt should be defined in the `agent_data/` directory with `conversation_details.json` with the user list in `users.json`
116
+ 3. Create your agent using the [Bolna Create Agent API](https://docs.bolna.dev/api-reference/endpoint/create). An agent will get created with an `agent_id`
117
+ 4. Instruct the agent to initiate call to users via `scripts/initiate_agent_call.py <agent_name> <agent_id>`
118
+
119
+
120
+ ## Open-source v/s Paid
121
+ Though the repository is completely open source, you can connect with us if interested in managed offerings or more customized solutions.
122
+
123
+ <a href="https://calendly.com/bolna/30min"><img alt="Schedule a meeting" src="https://cdn.cookielaw.org/logos/122ecfc3-4694-42f1-863f-2db42d1b1e68/0bcbbcf4-9b83-4684-ba59-bc913c0d5905/c21bea90-f4f1-43d1-8118-8938bbb27a9d/logo.png" /></a>
124
+
125
+
126
+ ## Contributing
127
+ We love all types of contributions: whether big or small helping in improving this community resource.
128
+
129
+ 1. There are a number of [open issues present](https://github.com/bolna-ai/bolna/issues) which can be good ones to start with
130
+ 2. If you have suggestions for enhancements, wish to contribute a simple fix such as correcting a typo, or want to address an apparent bug, please feel free to initiate a new issue or submit a pull request
131
+ 2. If you're contemplating a larger change or addition to this repository, be it in terms of its structure or the features, kindly begin by creating a new issue [open a new issue :octocat:](https://github.com/bolna-ai/bolna/issues/new) and outline your proposed changes. This will allow us to engage in a discussion before you dedicate a significant amount of time or effort. Your cooperation and understanding are appreciated
@@ -0,0 +1 @@
1
+ __version__ = "0.6.3"
@@ -0,0 +1,3 @@
1
+ from .base_manager import BaseManager
2
+ from .task_manager import TaskManager
3
+ from .assistant_manager import AssistantManager
@@ -0,0 +1,53 @@
1
+ import asyncio
2
+ import uvloop
3
+ import time
4
+ import os
5
+ from twilio.rest import Client
6
+ import requests
7
+ import tiktoken
8
+ from .base_manager import BaseManager
9
+ from .task_manager import TaskManager
10
+
11
+ # Find your Account SID and Auth Token at twilio.com/console
12
+ # and set the environment variables. See http://twil.io/secure
13
+ account_sid = os.environ['TWILIO_ACCOUNT_SID']
14
+ auth_token = os.environ['TWILIO_AUTH_TOKEN']
15
+ client = Client(account_sid, auth_token)
16
+ enc = tiktoken.get_encoding("cl100k_base")
17
+
18
+
19
+ class AssistantManager(BaseManager):
20
+ def __init__(self, agent_config, ws, context_data=None, user_id=None, assistant_id=None,
21
+ connected_through_dashboard=None, log_dir_name=None):
22
+ super().__init__(log_dir_name=log_dir_name)
23
+ self.log_dir_name = log_dir_name
24
+ self.tools = {}
25
+ self.websocket = ws
26
+ self.agent_config = agent_config
27
+ self.context_data = context_data
28
+ self.tasks = agent_config.get('tasks', [])
29
+ self.task_states = [False] * len(self.tasks)
30
+ self.user_id = user_id
31
+ self.assistant_id = assistant_id
32
+ self.run_id = f"{self.assistant_id}#{str(int(time.time() * 1000))}"
33
+ self.connected_through_dashboard = connected_through_dashboard
34
+
35
+ async def run(self, is_local=False):
36
+ '''
37
+ Run will start all tasks in sequential format
38
+ '''
39
+ asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
40
+ input_parameters = None
41
+ for task_id, task in enumerate(self.tasks):
42
+ task_manager = TaskManager(self.agent_config["assistant_name"], task_id, task, self.websocket,
43
+ context_data=self.context_data, input_parameters=input_parameters,
44
+ user_id=self.user_id, assistant_id=self.assistant_id, run_id=self.run_id,
45
+ connected_through_dashboard=self.connected_through_dashboard,
46
+ log_dir_name=self.log_dir_name)
47
+ await task_manager.load_prompt(self.agent_config["assistant_name"], task_id, is_local=is_local)
48
+ task_output = await task_manager.run()
49
+ task_output['run_id'] = self.run_id
50
+ yield task_id, task_output
51
+ self.task_states[task_id] = True
52
+ input_parameters = task_output
53
+ self.logger.info("Done with execution of the agent")
@@ -0,0 +1,8 @@
1
+ from bolna.helpers.logger_config import CustomLogger
2
+
3
+ custom_logger = CustomLogger(__name__)
4
+
5
+
6
+ class BaseManager:
7
+ def __init__(self, log_dir_name=None):
8
+ self.logger = custom_logger.update_logger(log_dir_name=log_dir_name)