ai-parrot 0.8.3__cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

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.

Potentially problematic release.


This version of ai-parrot might be problematic. Click here for more details.

Files changed (128) hide show
  1. ai_parrot-0.8.3.dist-info/LICENSE +21 -0
  2. ai_parrot-0.8.3.dist-info/METADATA +306 -0
  3. ai_parrot-0.8.3.dist-info/RECORD +128 -0
  4. ai_parrot-0.8.3.dist-info/WHEEL +6 -0
  5. ai_parrot-0.8.3.dist-info/top_level.txt +2 -0
  6. parrot/__init__.py +30 -0
  7. parrot/bots/__init__.py +5 -0
  8. parrot/bots/abstract.py +1115 -0
  9. parrot/bots/agent.py +492 -0
  10. parrot/bots/basic.py +9 -0
  11. parrot/bots/bose.py +17 -0
  12. parrot/bots/chatbot.py +271 -0
  13. parrot/bots/cody.py +17 -0
  14. parrot/bots/copilot.py +117 -0
  15. parrot/bots/data.py +730 -0
  16. parrot/bots/dataframe.py +103 -0
  17. parrot/bots/hrbot.py +15 -0
  18. parrot/bots/interfaces/__init__.py +1 -0
  19. parrot/bots/interfaces/retrievers.py +12 -0
  20. parrot/bots/notebook.py +619 -0
  21. parrot/bots/odoo.py +17 -0
  22. parrot/bots/prompts/__init__.py +41 -0
  23. parrot/bots/prompts/agents.py +91 -0
  24. parrot/bots/prompts/data.py +214 -0
  25. parrot/bots/retrievals/__init__.py +1 -0
  26. parrot/bots/retrievals/constitutional.py +19 -0
  27. parrot/bots/retrievals/multi.py +122 -0
  28. parrot/bots/retrievals/retrieval.py +610 -0
  29. parrot/bots/tools/__init__.py +7 -0
  30. parrot/bots/tools/eda.py +325 -0
  31. parrot/bots/tools/pdf.py +50 -0
  32. parrot/bots/tools/plot.py +48 -0
  33. parrot/bots/troc.py +16 -0
  34. parrot/conf.py +170 -0
  35. parrot/crew/__init__.py +3 -0
  36. parrot/crew/tools/__init__.py +22 -0
  37. parrot/crew/tools/bing.py +13 -0
  38. parrot/crew/tools/config.py +43 -0
  39. parrot/crew/tools/duckgo.py +62 -0
  40. parrot/crew/tools/file.py +24 -0
  41. parrot/crew/tools/google.py +168 -0
  42. parrot/crew/tools/gtrends.py +16 -0
  43. parrot/crew/tools/md2pdf.py +25 -0
  44. parrot/crew/tools/rag.py +42 -0
  45. parrot/crew/tools/search.py +32 -0
  46. parrot/crew/tools/url.py +21 -0
  47. parrot/exceptions.cpython-312-x86_64-linux-gnu.so +0 -0
  48. parrot/handlers/__init__.py +4 -0
  49. parrot/handlers/agents.py +292 -0
  50. parrot/handlers/bots.py +196 -0
  51. parrot/handlers/chat.py +192 -0
  52. parrot/interfaces/__init__.py +6 -0
  53. parrot/interfaces/database.py +27 -0
  54. parrot/interfaces/http.py +805 -0
  55. parrot/interfaces/images/__init__.py +0 -0
  56. parrot/interfaces/images/plugins/__init__.py +18 -0
  57. parrot/interfaces/images/plugins/abstract.py +58 -0
  58. parrot/interfaces/images/plugins/exif.py +709 -0
  59. parrot/interfaces/images/plugins/hash.py +52 -0
  60. parrot/interfaces/images/plugins/vision.py +104 -0
  61. parrot/interfaces/images/plugins/yolo.py +66 -0
  62. parrot/interfaces/images/plugins/zerodetect.py +197 -0
  63. parrot/llms/__init__.py +1 -0
  64. parrot/llms/abstract.py +69 -0
  65. parrot/llms/anthropic.py +58 -0
  66. parrot/llms/gemma.py +15 -0
  67. parrot/llms/google.py +44 -0
  68. parrot/llms/groq.py +67 -0
  69. parrot/llms/hf.py +45 -0
  70. parrot/llms/openai.py +61 -0
  71. parrot/llms/pipes.py +114 -0
  72. parrot/llms/vertex.py +89 -0
  73. parrot/loaders/__init__.py +9 -0
  74. parrot/loaders/abstract.py +628 -0
  75. parrot/loaders/files/__init__.py +0 -0
  76. parrot/loaders/files/abstract.py +39 -0
  77. parrot/loaders/files/text.py +63 -0
  78. parrot/loaders/txt.py +26 -0
  79. parrot/manager.py +333 -0
  80. parrot/models.py +504 -0
  81. parrot/py.typed +0 -0
  82. parrot/stores/__init__.py +11 -0
  83. parrot/stores/abstract.py +248 -0
  84. parrot/stores/chroma.py +188 -0
  85. parrot/stores/duck.py +162 -0
  86. parrot/stores/embeddings/__init__.py +10 -0
  87. parrot/stores/embeddings/abstract.py +46 -0
  88. parrot/stores/embeddings/base.py +52 -0
  89. parrot/stores/embeddings/bge.py +20 -0
  90. parrot/stores/embeddings/fastembed.py +17 -0
  91. parrot/stores/embeddings/google.py +18 -0
  92. parrot/stores/embeddings/huggingface.py +20 -0
  93. parrot/stores/embeddings/ollama.py +14 -0
  94. parrot/stores/embeddings/openai.py +26 -0
  95. parrot/stores/embeddings/transformers.py +21 -0
  96. parrot/stores/embeddings/vertexai.py +17 -0
  97. parrot/stores/empty.py +10 -0
  98. parrot/stores/faiss.py +160 -0
  99. parrot/stores/milvus.py +397 -0
  100. parrot/stores/postgres.py +653 -0
  101. parrot/stores/qdrant.py +170 -0
  102. parrot/tools/__init__.py +23 -0
  103. parrot/tools/abstract.py +68 -0
  104. parrot/tools/asknews.py +33 -0
  105. parrot/tools/basic.py +51 -0
  106. parrot/tools/bby.py +359 -0
  107. parrot/tools/bing.py +13 -0
  108. parrot/tools/docx.py +343 -0
  109. parrot/tools/duck.py +62 -0
  110. parrot/tools/execute.py +56 -0
  111. parrot/tools/gamma.py +28 -0
  112. parrot/tools/google.py +170 -0
  113. parrot/tools/gvoice.py +301 -0
  114. parrot/tools/results.py +278 -0
  115. parrot/tools/stack.py +27 -0
  116. parrot/tools/weather.py +70 -0
  117. parrot/tools/wikipedia.py +58 -0
  118. parrot/tools/zipcode.py +198 -0
  119. parrot/utils/__init__.py +2 -0
  120. parrot/utils/parsers/__init__.py +5 -0
  121. parrot/utils/parsers/toml.cpython-312-x86_64-linux-gnu.so +0 -0
  122. parrot/utils/toml.py +11 -0
  123. parrot/utils/types.cpython-312-x86_64-linux-gnu.so +0 -0
  124. parrot/utils/uv.py +11 -0
  125. parrot/version.py +10 -0
  126. resources/users/__init__.py +5 -0
  127. resources/users/handlers.py +13 -0
  128. resources/users/models.py +205 -0
parrot/models.py ADDED
@@ -0,0 +1,504 @@
1
+ from typing import Dict, List, Union, Optional
2
+ import uuid
3
+ import time
4
+ from datetime import datetime
5
+ from pathlib import Path, PurePath
6
+ from enum import Enum
7
+ from langchain_core.agents import AgentAction
8
+
9
+ from datamodel import BaseModel, Field
10
+ from datamodel.types import Text # pylint: disable=no-name-in-module
11
+ from asyncdb.models import Model
12
+
13
+
14
+ def created_at(*args, **kwargs) -> int:
15
+ return int(time.time()) * 1000
16
+
17
+
18
+ class AgentResponse(BaseModel):
19
+ """AgentResponse.
20
+ dict_keys(
21
+ ['input', 'chat_history', 'output', 'intermediate_steps']
22
+ )
23
+
24
+ Response from Chatbots.
25
+ """
26
+ question: str = Field(required=False)
27
+ input: Union[str, Dict[str, str]] = Field(required=False)
28
+ output: Union[str, Dict[str, str]] = Field(required=False)
29
+ response: str = Field(required=False)
30
+ answer: str = Field(required=False)
31
+ intermediate_steps: list = Field(default_factory=list)
32
+ chat_history: list = Field(repr=True, default_factory=list)
33
+ source_documents: list = Field(required=False, default_factory=list)
34
+ filename: Dict[Path, str] = Field(required=False)
35
+
36
+ def __post_init__(self) -> None:
37
+ super().__post_init__()
38
+ if self.output:
39
+ self.answer = self.output
40
+ if self.intermediate_steps:
41
+ steps = []
42
+ for item, result in self.intermediate_steps:
43
+ if isinstance(item, AgentAction):
44
+ # convert into dictionary:
45
+ steps.append(
46
+ {
47
+ "tool": item.tool,
48
+ "tool_input": item.tool_input,
49
+ "result": result,
50
+ "log": str(item.log)
51
+ }
52
+ )
53
+ if steps:
54
+ self.intermediate_steps = steps
55
+
56
+
57
+ class ChatResponse(BaseModel):
58
+ """ChatResponse.
59
+ dict_keys(
60
+ ['question', 'chat_history', 'answer', 'source_documents', 'generated_question']
61
+ )
62
+
63
+ Response from Chatbots.
64
+ """
65
+ query: str = Field(required=False)
66
+ result: str = Field(required=False)
67
+ question: str = Field(required=False)
68
+ generated_question: str = Field(required=False)
69
+ answer: str = Field(required=False)
70
+ response: str = Field(required=False)
71
+ chat_history: list = Field(repr=True, default_factory=list)
72
+ source_documents: list = Field(required=False, default_factory=list)
73
+ documents: dict = Field(required=False, default_factory=dict)
74
+ sid: uuid.UUID = Field(primary_key=True, required=False, default=uuid.uuid4)
75
+ at: int = Field(default=created_at)
76
+
77
+ def __post_init__(self) -> None:
78
+ if self.result and not self.answer:
79
+ self.answer = self.result
80
+ if self.question and not self.generated_question:
81
+ self.generated_question = self.question
82
+ return super().__post_init__()
83
+
84
+ def default_embed_model():
85
+ return {"model_name": "thenlper/gte-base", "model_type": "huggingface"}
86
+
87
+ # Chatbot Model:
88
+ class ChatbotModel(Model):
89
+ """Chatbot.
90
+ --- drop table navigator.chatbots;
91
+ CREATE TABLE IF NOT EXISTS navigator.chatbots (
92
+ chatbot_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
93
+ name VARCHAR NOT NULL DEFAULT 'Nav',
94
+ description VARCHAR,
95
+ config_file VARCHAR,
96
+ company_information JSONB DEFAULT '{}'::JSONB,
97
+ avatar TEXT,
98
+ enabled BOOLEAN NOT NULL DEFAULT TRUE,
99
+ timezone VARCHAR DEFAULT 'UTC',
100
+ bot_class VARCHAR DEFAULT 'BasicBot',
101
+ attributes JSONB DEFAULT '{}'::JSONB,
102
+ role VARCHAR DEFAULT 'a Human Resources Assistant',
103
+ goal VARCHAR NOT NULL DEFAULT 'Bring useful information to Users.',
104
+ backstory VARCHAR NOT NULL DEFAULT 'I was created by a team of developers to assist with users tasks.',
105
+ rationale VARCHAR NOT NULL DEFAULT 'Remember to maintain a professional tone. Please provide accurate and relevant information.',
106
+ language VARCHAR DEFAULT 'en',
107
+ system_prompt_template VARCHAR,
108
+ human_prompt_template VARCHAR,
109
+ pre_instructions JSONB DEFAULT '[]'::JSONB,
110
+ llm VARCHAR DEFAULT 'vertexai',
111
+ model_name VARCHAR DEFAULT 'gemini-1.5-pro',
112
+ model_config JSONB DEFAULT '{}'::JSONB,
113
+ embedding_model JSONB DEFAULT '{"model_name": "thenlper/gte-base", "model_type": "huggingface"}',
114
+ summarize_model JSONB DEFAULT '{"model_name": "facebook/bart-large-cnn", "model_type": "huggingface"}',
115
+ classification_model JSONB DEFAULT '{"model_name": "facebook/bart-large-cnn", "model_type": "huggingface"}',
116
+ vector_store BOOLEAN not null default FALSE,
117
+ database JSONB DEFAULT '{"vector_database": "milvus", "database": "TROC", "collection_name": "troc_information"}'::JSONB,
118
+ bot_type varchar default 'chatbot',
119
+ created_at TIMESTAMPTZ DEFAULT NOW(),
120
+ created_by INTEGER,
121
+ updated_at TIMESTAMPTZ DEFAULT NOW(),
122
+ disclaimer VARCHAR,
123
+ permissions JSONB
124
+ );
125
+ ALTER TABLE navigator.chatbots
126
+ ADD CONSTRAINT unq_navigator_chatbots_name UNIQUE (name);
127
+ """
128
+ chatbot_id: uuid.UUID = Field(primary_key=True, required=False, default_factory=uuid.uuid4)
129
+ name: str = Field(default='Nav', required=True, primary_key=True)
130
+ description: str = Field(default='Nav Chatbot', required=False)
131
+ config_file: str = Field(required=False)
132
+ bot_class: str = Field(required=False, default=None)
133
+ company_information: dict = Field(default_factory=dict, required=False)
134
+ avatar: str
135
+ enabled: bool = Field(required=True, default=True)
136
+ timezone: str = Field(required=False, max=75, default="UTC", repr=False)
137
+ attributes: Optional[dict] = Field(required=False, default_factory=dict)
138
+ # Chatbot Configuration
139
+ role: str = Field(
140
+ default="a Human Resources Assistant",
141
+ required=False
142
+ )
143
+ goal: str = Field(
144
+ default="Bring useful information to Users.",
145
+ required=True
146
+ )
147
+ backstory: str = Field(
148
+ default="I was created by a team of developers to assist with users tasks.",
149
+ required=True
150
+ )
151
+ rationale: str = Field(
152
+ default=(
153
+ "Remember to maintain a professional tone."
154
+ " Please provide accurate and relevant information."
155
+ ),
156
+ required=True
157
+ )
158
+ language: str = Field(default='en', required=False)
159
+ system_prompt_template: Union[str, PurePath] = Field(
160
+ default=None,
161
+ required=False
162
+ )
163
+ human_prompt_template: Union[str, PurePath] = Field(
164
+ default=None,
165
+ required=False
166
+ )
167
+ pre_instructions: List[str] = Field(
168
+ default_factory=list,
169
+ required=False
170
+ )
171
+ # Model Configuration:
172
+ llm: str = Field(default='vertexai', required=False)
173
+ model_name: str = Field(default='gemini-1.5-pro', required=False)
174
+ model_config: dict = Field(default_factory=dict, required=False)
175
+ embedding_model: dict = Field(default=default_embed_model, required=False)
176
+ # Summarization/Classification Models: {"model_name": "facebook/bart-large-cnn", "model_type": "huggingface"}
177
+ summarize_model: dict = Field(default_factory=dict, required=False)
178
+ classification_model: dict = Field(default_factory=dict, required=False)
179
+ # Database Configuration
180
+ vector_store: bool = Field(default=False, required=False)
181
+ database: dict = Field(required=False, default_factory=dict)
182
+ # Bot/Agent type
183
+ bot_type: str = Field(default='chatbot', required=False)
184
+ # When created
185
+ created_at: datetime = Field(required=False, default=datetime.now)
186
+ created_by: int = Field(required=False)
187
+ updated_at: datetime = Field(required=False, default=datetime.now)
188
+ disclaimer: str = Field(required=False)
189
+ permissions: dict = Field(required=False, default_factory=dict)
190
+
191
+
192
+ def __post_init__(self) -> None:
193
+ super(ChatbotModel, self).__post_init__()
194
+ if self.config_file:
195
+ if isinstance(self.config_file, str):
196
+ self.config_file = Path(self.config_file).resolve()
197
+
198
+ class Meta:
199
+ """Meta Chatbot."""
200
+ driver = 'pg'
201
+ name = "chatbots"
202
+ schema = "navigator"
203
+ strict = True
204
+ frozen = False
205
+
206
+
207
+ class ChatbotUsage(Model):
208
+ """ChatbotUsage.
209
+
210
+ Saving information about Chatbot Usage.
211
+
212
+ -- ScyllaDB CREATE TABLE Syntax --
213
+ CREATE TABLE IF NOT EXISTS navigator.chatbots_usage (
214
+ chatbot_id TEXT,
215
+ user_id SMALLINT,
216
+ sid TEXT,
217
+ source_path TEXT,
218
+ platform TEXT,
219
+ origin inet,
220
+ user_agent TEXT,
221
+ question TEXT,
222
+ response TEXT,
223
+ used_at BIGINT,
224
+ at TEXT,
225
+ PRIMARY KEY ((chatbot_id, sid, at), used_at)
226
+ ) WITH CLUSTERING ORDER BY (used_at DESC)
227
+ AND default_time_to_live = 10368000;
228
+
229
+ """
230
+ chatbot_id: uuid.UUID = Field(primary_key=True, required=False)
231
+ user_id: int = Field(primary_key=True, required=False)
232
+ sid: uuid.UUID = Field(primary_key=True, required=False, default=uuid.uuid4)
233
+ source_path: str = Field(required=False, default='web')
234
+ platform: str = Field(required=False, default='web')
235
+ origin: str = Field(required=False)
236
+ user_agent: str = Field(required=False)
237
+ question: str = Field(required=False)
238
+ response: str = Field(required=False)
239
+ used_at: int = Field(required=False, default=created_at)
240
+ event_timestamp: datetime = Field(required=False, default=datetime.now)
241
+ _at: str = Field(primary_key=True, required=False)
242
+
243
+ class Meta:
244
+ """Meta Chatbot."""
245
+ driver = 'bigquery'
246
+ name = "chatbots_usage"
247
+ schema = "navigator"
248
+ ttl = 10368000 # 120 days in seconds
249
+ strict = True
250
+ frozen = False
251
+
252
+ def __post_init__(self) -> None:
253
+ if not self._at:
254
+ # Generate a unique session id
255
+ self._at = f'{self.sid}:{self.used_at}'
256
+ super(ChatbotUsage, self).__post_init__()
257
+
258
+
259
+ class FeedbackType(Enum):
260
+ """FeedbackType."""
261
+ # Good Feedback
262
+ GOOD_COMPLETE = "Completeness"
263
+ GOOD_CORRECT = "Correct"
264
+ GOOD_FOLLOW = "Follow the instructions"
265
+ GOOD_UNDERSTAND = "Understandable"
266
+ GOOD_USEFUL = "very useful"
267
+ GOOD_OTHER = "Please Explain"
268
+ # Bad Feedback
269
+ BAD_DONTLIKE = "Don't like the style"
270
+ BAD_INCORRECT = "Incorrect"
271
+ BAD_NOTFOLLOW = "Didn't follow the instructions"
272
+ BAD_LAZY = "Being lazy"
273
+ BAD_NOTUSEFUL = "Not useful"
274
+ BAD_UNSAFE = "Unsafe or problematic"
275
+ BAD_OTHER = "Other"
276
+
277
+ @classmethod
278
+ def list_feedback(cls, feedback_category):
279
+ """Return a list of feedback types based on the given category (Good or Bad)."""
280
+ prefix = feedback_category.upper() + "_"
281
+ return [feedback for feedback in cls if feedback.name.startswith(prefix)]
282
+
283
+ class ChatbotFeedback(Model):
284
+ """ChatbotFeedback.
285
+
286
+ Saving information about Chatbot Feedback.
287
+
288
+ -- ScyllaDB CREATE TABLE Syntax --
289
+ CREATE TABLE IF NOT EXISTS navigator.chatbots_feedback (
290
+ chatbot_id UUID,
291
+ user_id INT,
292
+ sid UUID,
293
+ at TEXT,
294
+ rating TINYINT,
295
+ like BOOLEAN,
296
+ dislike BOOLEAN,
297
+ feedback_type TEXT,
298
+ feedback TEXT,
299
+ created_at BIGINT,
300
+ PRIMARY KEY ((chatbot_id, user_id, sid), created_at)
301
+ ) WITH CLUSTERING ORDER BY (created_at DESC)
302
+ AND default_time_to_live = 7776000;
303
+
304
+ """
305
+ chatbot_id: uuid.UUID = Field(primary_key=True, required=False)
306
+ user_id: int = Field(required=False)
307
+ sid: uuid.UUID = Field(primary_key=True, required=False)
308
+ _at: str = Field(primary_key=True, required=False)
309
+ # feedback information:
310
+ rating: int = Field(required=False, default=0)
311
+ _like: bool = Field(required=False, default=False)
312
+ _dislike: bool = Field(required=False, default=False)
313
+ feedback_type: FeedbackType = Field(required=False)
314
+ feedback: str = Field(required=False)
315
+ created_at: int = Field(required=False, default=created_at)
316
+ expiration_timestamp: datetime = Field(required=False, default=datetime.now)
317
+
318
+ class Meta:
319
+ """Meta Chatbot."""
320
+ driver = 'bigquery'
321
+ name = "chatbots_feedback"
322
+ schema = "navigator"
323
+ ttl = 7776000 # 3 months in seconds
324
+ strict = True
325
+ frozen = False
326
+
327
+ def __post_init__(self) -> None:
328
+ if not self._at:
329
+ # Generate a unique session id
330
+ if not self.created_at:
331
+ self.created_at = created_at()
332
+ self._at = f'{self.sid}:{self.created_at}'
333
+ super(ChatbotFeedback, self).__post_init__()
334
+
335
+
336
+ ## Prompt Library:
337
+
338
+ class PromptCategory(Enum):
339
+ """
340
+ Prompt Category.
341
+
342
+ Categorization of Prompts, as "tech",
343
+ "tech-or-explain", "idea", "explain", "action", "command", "other".
344
+ """
345
+ TECH = "tech"
346
+ TECH_OR_EXPLAIN = "tech-or-explain"
347
+ IDEA = "idea"
348
+ EXPLAIN = "explain"
349
+ ACTION = "action"
350
+ COMMAND = "command"
351
+ OTHER = "other"
352
+
353
+ class PromptLibrary(Model):
354
+ """PromptLibrary.
355
+
356
+ Saving information about Prompt Library.
357
+
358
+ -- PostgreSQL CREATE TABLE Syntax --
359
+ CREATE TABLE IF NOT EXISTS navigator.prompt_library (
360
+ prompt_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
361
+ chatbot_id UUID,
362
+ title varchar,
363
+ query varchar,
364
+ description TEXT,
365
+ prompt_category varchar,
366
+ prompt_tags varchar[],
367
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
368
+ created_by INTEGER,
369
+ updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
370
+ );
371
+ """
372
+ prompt_id: uuid.UUID = Field(primary_key=True, required=False, default_factory=uuid.uuid4)
373
+ chatbot_id: uuid.UUID = Field(required=True)
374
+ title: str = Field(required=True)
375
+ query: str = Field(required=True)
376
+ description: str = Field(required=False)
377
+ prompt_category: str = Field(required=False, default=PromptCategory.OTHER)
378
+ prompt_tags: list = Field(required=False, default_factory=list)
379
+ created_at: datetime = Field(required=False, default=datetime.now)
380
+ created_by: int = Field(required=False)
381
+ updated_at: datetime = Field(required=False, default=datetime.now)
382
+
383
+ class Meta:
384
+ """Meta Prompt Library."""
385
+ driver = 'pg'
386
+ name = "prompt_library"
387
+ schema = "navigator"
388
+ strict = True
389
+ frozen = False
390
+
391
+
392
+ def __post_init__(self) -> None:
393
+ super(PromptLibrary, self).__post_init__()
394
+
395
+ ### Agent Information:
396
+ # AgentModel Model:
397
+
398
+ def agent_id() -> str:
399
+ """Generate a random UUID."""
400
+ return str(uuid.uuid4())
401
+
402
+ class AgentModel(Model):
403
+ """AgentModel.
404
+ ---- drop table if exists navigator.ai_agents;
405
+ CREATE TABLE IF NOT EXISTS navigator.ai_agents (
406
+ chatbot_id varchar PRIMARY KEY DEFAULT uuid_generate_v4(),
407
+ name VARCHAR NOT NULL DEFAULT 'Nav',
408
+ description VARCHAR,
409
+ avatar TEXT,
410
+ enabled BOOLEAN NOT NULL DEFAULT TRUE,
411
+ agent_class VARCHAR,
412
+ attributes JSONB DEFAULT '{}'::JSONB,
413
+ role VARCHAR DEFAULT 'a Human Resources Assistant',
414
+ goal VARCHAR NOT NULL DEFAULT 'Bring useful information to Users.',
415
+ backstory VARCHAR NOT NULL DEFAULT 'I was created by a team of developers to assist with users tasks.',
416
+ rationale VARCHAR NOT NULL DEFAULT 'Remember to maintain a professional tone. Please provide accurate and relevant information.',
417
+ capabilities TEXT,
418
+ query JSONB,
419
+ tools JSONB,
420
+ system_prompt_template VARCHAR,
421
+ human_prompt_template VARCHAR,
422
+ llm VARCHAR DEFAULT 'vertexai',
423
+ model_name VARCHAR DEFAULT 'gemini-1.5-pro',
424
+ temperature float DEFAULT 0.1,
425
+ model_config JSONB DEFAULT '{}'::JSONB,
426
+ created_at TIMESTAMPTZ DEFAULT NOW(),
427
+ created_by INTEGER,
428
+ updated_at TIMESTAMPTZ DEFAULT NOW(),
429
+ disclaimer VARCHAR,
430
+ permissions JSONB
431
+ );
432
+ ALTER TABLE navigator.ai_agents
433
+ ADD CONSTRAINT unq_navigator_agents_name UNIQUE (name);
434
+ """
435
+ chatbot_id: str = Field(primary_key=True, required=False, default_factory=agent_id)
436
+ name: str = Field(default='Nav', required=True, primary_key=True)
437
+ description: str = Field(required=False)
438
+ agent_class: str = Field(required=False, default='PandasAgent')
439
+ avatar: str
440
+ enabled: bool = Field(required=True, default=True)
441
+ attributes: Optional[dict] = Field(required=False, default_factory=dict)
442
+ # Agent Configuration
443
+ tools: List[str] = Field(
444
+ default_factory=list,
445
+ required=False
446
+ )
447
+ role: str = Field(
448
+ default="a Human Resources Assistant",
449
+ required=False
450
+ )
451
+ goal: str = Field(
452
+ default="Bring useful information to Users.",
453
+ required=True
454
+ )
455
+ backstory: str = Field(
456
+ default="I was created by a team of developers to assist with users tasks.",
457
+ required=True
458
+ )
459
+ rationale: str = Field(
460
+ default=(
461
+ "Remember to maintain a professional tone."
462
+ " Please provide accurate and relevant information."
463
+ ),
464
+ required=True
465
+ )
466
+ capabilities: str = Field(
467
+ default="",
468
+ required=False
469
+ )
470
+ query: Union[list, dict] = Field(
471
+ required=True
472
+ )
473
+ system_prompt_template: Union[str, PurePath] = Field(
474
+ default=None,
475
+ required=False
476
+ )
477
+ human_prompt_template: Union[str, PurePath] = Field(
478
+ default=None,
479
+ required=False
480
+ )
481
+ # Model Configuration:
482
+ llm: str = Field(default='vertexai', required=False)
483
+ use_llm: Optional[str] = Field(default='vertexai', required=False)
484
+ model_name: str = Field(default='gemini-2.5-pro-preview-03-25', required=False)
485
+ temperature: float = Field(default=0.1, required=False)
486
+ model_config: dict = Field(default_factory=dict, required=False)
487
+ # When created
488
+ created_at: datetime = Field(required=False, default=datetime.now)
489
+ created_by: int = Field(required=False)
490
+ updated_at: datetime = Field(required=False, default=datetime.now)
491
+ disclaimer: str = Field(required=False)
492
+ permissions: dict = Field(required=False, default_factory=dict)
493
+
494
+
495
+ def __post_init__(self) -> None:
496
+ super(AgentModel, self).__post_init__()
497
+
498
+ class Meta:
499
+ """Meta Agent."""
500
+ driver = 'pg'
501
+ name = "ai_agents"
502
+ schema = "navigator"
503
+ strict = True
504
+ frozen = False
parrot/py.typed ADDED
File without changes
@@ -0,0 +1,11 @@
1
+ from .abstract import AbstractStore
2
+ from .empty import EmptyStore
3
+
4
+ supported_stores = {
5
+ 'chroma': 'ChromaStore',
6
+ 'duck': 'DuckDBStore',
7
+ 'milvus': 'MilvusStore',
8
+ 'qdrant': 'QdrantStore',
9
+ 'postgres': 'PgvectorStore',
10
+ 'faiss': 'FaissStore',
11
+ }