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
+26-32
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,4 @@
1
-
Here is the GitHub documentation for the AI Assistant project with proper Markdown formatting:
2
-
3
-
---
4
-
5
-
# Computer
6
-
7
-
I named this project "computer", because in the long run I want to implement hotword "Hei Computer" to trigger start of conversation.
8
-
1
+
# Bobik - AI Assistant
9
2
10
3
This project wraps most of langchain features and agent functionality and abstracts them into configuration file.
11
4
As a user, you need to set up necessary api keys in .env file and define your models in my_config.yaml file.
@@ -43,6 +36,7 @@ Features:
43
36
--- google search
44
37
--- wikipedia
45
38
- piping stdin input as question
39
+
- pasting input from clipboard - Use following template "my question here: <paste>"
46
40
- llm providers
47
41
-- openai
48
42
-- groq
@@ -68,7 +62,7 @@ To install the AI Assistant, follow these steps:
68
62
2. Clone the repository from GitHub.
69
63
3. Install the required packages using `pip install -r requirements.txt`.
70
64
4. See `examples` to set up necessary environment variables and config yaml file.
71
-
5. Run the `computer.py` script to start the AI Assistant.
65
+
5. Run the `run.py` script to start the AI Assistant.
72
66
73
67
## Windows
74
68
Main functionality on Windows is working fine.
@@ -94,10 +88,10 @@ See `examples` folder for more info.
94
88
#### State change
95
89
The App pre-parsers can be used to change the model, input or output method and more things with the first words in the message. Here are some examples:
96
90
97
-
- To change the model to `gpt-3.5-turbo`, you can use the following pre-parser command: `computer.py gpt-3.5-turbo speak listen tell me a story`.
98
-
- To change the input and output method to `voice`, you can use the following pre-parser command: `computer.py verbal`.
99
-
- To change only input: `computer.py listen`. Remember to have same name here that is configured in `my_config.yaml` file under `io_input`, `io_output` and `models`.
100
-
- Or just use default method that mostly should be set up as `text`: `computer.py When I will have time for a jogging session. Check my calendar events and weather so it is not raining and I have no meetings then.`.
91
+
- To change the model to `gpt-3.5-turbo`, you can use the following pre-parser command: `run.py gpt-3.5-turbo speak listen tell me a story`.
92
+
- To change the input and output method to `voice`, you can use the following pre-parser command: `run.py verbal`.
93
+
- To change only input: `run.py listen`. Remember to have same name here that is configured in `my_config.yaml` file under `io_input`, `io_output` and `models`.
94
+
- Or just use default method that mostly should be set up as `text`: `run.py When I will have time for a jogging session. Check my calendar events and weather so it is not raining and I have no meetings then.`.
101
95
102
96
Note: These pre-parser commands should be included at the beginning of the first message.
103
97
@@ -141,14 +135,14 @@ class MotivationTool(BaseTool):
141
135
```
142
136
3. Register the custom tool with the `ToolLoader` class by adding the following line to the `app/tool_loader.py` file:
143
137
```python
144
-
computer=Computer()
145
-
# ... see computer.py for more details
146
-
computer.load_config_and_state()
147
-
computer.load_options()
148
-
computer.load_state_change_parser()
149
-
computer.load_manager()
150
-
computer.tool_provider.add_tool(MotivationTool())
151
-
computer.start(False, "I need something to cheer me up.")
138
+
app=App()
139
+
# ... see app.py for more details
140
+
app.load_config_and_state()
141
+
app.load_options()
142
+
app.load_state_change_parser()
143
+
app.load_manager()
144
+
app.tool_provider.add_tool(MotivationTool())
145
+
app.start(False, "I need something to cheer me up.")
152
146
```
153
147
154
148
It is good idea to create your own main python script. Then origin future updates will not destroy your code.
@@ -157,14 +151,14 @@ It is good idea to create your own main python script. Then origin future update
157
151
158
152
### Using the Tool as Is
159
153
160
-
To use the AI Assistant as is, simply run the `computer.py` script and start interacting with it through the command line interface.
154
+
To use the AI Assistant as is, simply run the `app.py` script and start interacting with it through the command line interface.
161
155
It will run in the loop using default `agent` (depends on model configuration) mode with memory attached.
162
156
163
157
### Using the Tool as a Library
164
158
165
159
You can also use the AI Assistant as a library in your own Python projects.
166
160
To do this, you need to import the necessary classes and functions from the `app` package and
167
-
create an instance of the `Computer` or `ConversationManager` class.
161
+
create an instance of the `App` or `ConversationManager` class.
168
162
169
163
The `ConversationManager` class is responsible for managing the conversation between the user and the AI Assistant.
170
164
It provides various methods for sending messages, handling events, and customizing the behavior of the AI Assistant.
@@ -182,21 +176,21 @@ Here are some examples of how you can extend the code with your own tools:
182
176
Here are some examples of how you can execute the project:
183
177
184
178
- Using the `--quiet` mode:
185
-
If you want to run the AI Assistant in quiet mode, you can use the `--quiet` flag when running the `computer.py` script.
179
+
If you want to run the AI Assistant in quiet mode, you can use the `--quiet` flag when running the `app.py` script.
186
180
In quiet mode, the AI Assistant will not print any messages to the console, except for LLM final answer.
187
181
```bash
188
-
python computer.py --quiet
182
+
python app.py --quiet
189
183
```
190
184
- Using different models:
191
-
If you want to use a different language model than the one that is enabled by default, you can use the model name when running the `computer.py`.
185
+
If you want to use a different language model than the one that is enabled by default, you can use the model name when running the `app.py`.
192
186
The question pre-parser will hard match first parameters with available configuration and will change application state.
193
187
After that application will realize that state was changed and will reload the configuration, model and agent.
194
188
195
189
- Switching models during usage:
196
190
During usage, you can change models and history will be kept. So you can ask a story from one model and then switch to another model and ask for summary.
197
191
This works only when `--once` parameter is not used.
198
192
```bash
199
-
computer.py --quiet groq tell me 3 sentence story
193
+
app.py --quiet groq tell me 3 sentence story
200
194
> Here is a 3 sentence story: As the sun set over the Berlin skyline, a young artist named Lena sat on the banks of the Spree River, her paintbrush dancing across the canvas as she tried to capture the vibrant colors of the city. Meanwhile, a group of friends laughed and chatted as they strolled along the riverbank, enjoying the warm summer evening. In the distance, the sounds of a street performer's guitar drifted through the air, adding to the lively atmosphere of the city.
201
195
> Master: gpt4o
202
196
> Master: summarize the story in 1 sentence
@@ -205,7 +199,7 @@ computer.py --quiet groq tell me 3 sentence story
205
199
206
200
There are also built in tools that will understand that you want to change model from the message.
207
201
```bash
208
-
computer.py groq
202
+
app.py groq
209
203
phrase 'groq' detected.
210
204
Changed model to groq
211
205
Got 1 args: ['groq']
@@ -223,7 +217,7 @@ Thought: Do I need to use a tool? No
223
217
AI: Model switched to gpt3. I'm ready to assist you. How can I help you today?
224
218
225
219
> Finished chain.
226
-
Computer: Model switched to gpt3. I'm ready to assist you. How can I help you today?
220
+
Bobik: Model switched to gpt3. I'm ready to assist you. How can I help you today?
227
221
text → gpt3 (gpt-3.5-turbo) → write
228
222
Master: |
229
223
```
@@ -235,15 +229,15 @@ Same thing is implemented for:
235
229
- turn on/off tools (agent vs no agent)
236
230
237
231
### Using the `--once` parameter:
238
-
If you want to run the AI Assistant only once and then exit, you can use the `--once` flag when running the `computer.py` script.
232
+
If you want to run the AI Assistant only once and then exit, you can use the `--once` flag when running the `app.py` script.
239
233
The `--once` flag should be followed by the message that you want to send to the AI Assistant.
240
234
```bash
241
-
python computer.py --once "What's the weather like today?"
235
+
python app.py --once "What's the weather like today?"
242
236
```
243
237
The `--once` parameter is useful when you want to use the AI Assistant to perform a specific task and then exit, without having to interact with it through the command line interface.
244
238
It is good idea to combine `--once` together with `--quiet` parameter. Then you will get only answer without any additional information.
0 commit comments