ai-parrot 0.1.0__cp311-cp311-manylinux_2_28_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 (108) hide show
  1. ai_parrot-0.1.0.dist-info/LICENSE +21 -0
  2. ai_parrot-0.1.0.dist-info/METADATA +299 -0
  3. ai_parrot-0.1.0.dist-info/RECORD +108 -0
  4. ai_parrot-0.1.0.dist-info/WHEEL +5 -0
  5. ai_parrot-0.1.0.dist-info/top_level.txt +3 -0
  6. parrot/__init__.py +18 -0
  7. parrot/chatbots/__init__.py +7 -0
  8. parrot/chatbots/abstract.py +965 -0
  9. parrot/chatbots/asktroc.py +16 -0
  10. parrot/chatbots/base.py +257 -0
  11. parrot/chatbots/basic.py +9 -0
  12. parrot/chatbots/bose.py +17 -0
  13. parrot/chatbots/cody.py +17 -0
  14. parrot/chatbots/copilot.py +100 -0
  15. parrot/chatbots/dataframe.py +103 -0
  16. parrot/chatbots/hragents.py +15 -0
  17. parrot/chatbots/oddie.py +17 -0
  18. parrot/chatbots/retrievals/__init__.py +515 -0
  19. parrot/chatbots/retrievals/constitutional.py +19 -0
  20. parrot/conf.py +108 -0
  21. parrot/crew/__init__.py +3 -0
  22. parrot/crew/tools/__init__.py +22 -0
  23. parrot/crew/tools/bing.py +13 -0
  24. parrot/crew/tools/config.py +43 -0
  25. parrot/crew/tools/duckgo.py +62 -0
  26. parrot/crew/tools/file.py +24 -0
  27. parrot/crew/tools/google.py +168 -0
  28. parrot/crew/tools/gtrends.py +16 -0
  29. parrot/crew/tools/md2pdf.py +25 -0
  30. parrot/crew/tools/rag.py +42 -0
  31. parrot/crew/tools/search.py +32 -0
  32. parrot/crew/tools/url.py +21 -0
  33. parrot/exceptions.cpython-311-x86_64-linux-gnu.so +0 -0
  34. parrot/handlers/__init__.py +4 -0
  35. parrot/handlers/bots.py +196 -0
  36. parrot/handlers/chat.py +169 -0
  37. parrot/interfaces/__init__.py +6 -0
  38. parrot/interfaces/database.py +29 -0
  39. parrot/llms/__init__.py +0 -0
  40. parrot/llms/abstract.py +41 -0
  41. parrot/llms/anthropic.py +36 -0
  42. parrot/llms/google.py +37 -0
  43. parrot/llms/groq.py +33 -0
  44. parrot/llms/hf.py +39 -0
  45. parrot/llms/openai.py +49 -0
  46. parrot/llms/pipes.py +103 -0
  47. parrot/llms/vertex.py +68 -0
  48. parrot/loaders/__init__.py +20 -0
  49. parrot/loaders/abstract.py +456 -0
  50. parrot/loaders/basepdf.py +102 -0
  51. parrot/loaders/basevideo.py +280 -0
  52. parrot/loaders/csv.py +42 -0
  53. parrot/loaders/dir.py +37 -0
  54. parrot/loaders/excel.py +349 -0
  55. parrot/loaders/github.py +65 -0
  56. parrot/loaders/handlers/__init__.py +5 -0
  57. parrot/loaders/handlers/data.py +213 -0
  58. parrot/loaders/image.py +119 -0
  59. parrot/loaders/json.py +52 -0
  60. parrot/loaders/pdf.py +187 -0
  61. parrot/loaders/pdfchapters.py +142 -0
  62. parrot/loaders/pdffn.py +112 -0
  63. parrot/loaders/pdfimages.py +207 -0
  64. parrot/loaders/pdfmark.py +88 -0
  65. parrot/loaders/pdftables.py +145 -0
  66. parrot/loaders/ppt.py +30 -0
  67. parrot/loaders/qa.py +81 -0
  68. parrot/loaders/repo.py +103 -0
  69. parrot/loaders/rtd.py +65 -0
  70. parrot/loaders/txt.py +92 -0
  71. parrot/loaders/utils/__init__.py +1 -0
  72. parrot/loaders/utils/models.py +25 -0
  73. parrot/loaders/video.py +96 -0
  74. parrot/loaders/videolocal.py +107 -0
  75. parrot/loaders/vimeo.py +106 -0
  76. parrot/loaders/web.py +216 -0
  77. parrot/loaders/web_base.py +112 -0
  78. parrot/loaders/word.py +125 -0
  79. parrot/loaders/youtube.py +192 -0
  80. parrot/manager.py +152 -0
  81. parrot/models.py +347 -0
  82. parrot/py.typed +0 -0
  83. parrot/stores/__init__.py +0 -0
  84. parrot/stores/abstract.py +170 -0
  85. parrot/stores/milvus.py +540 -0
  86. parrot/stores/qdrant.py +153 -0
  87. parrot/tools/__init__.py +16 -0
  88. parrot/tools/abstract.py +53 -0
  89. parrot/tools/asknews.py +32 -0
  90. parrot/tools/bing.py +13 -0
  91. parrot/tools/duck.py +62 -0
  92. parrot/tools/google.py +170 -0
  93. parrot/tools/stack.py +26 -0
  94. parrot/tools/weather.py +70 -0
  95. parrot/tools/wikipedia.py +59 -0
  96. parrot/tools/zipcode.py +179 -0
  97. parrot/utils/__init__.py +2 -0
  98. parrot/utils/parsers/__init__.py +5 -0
  99. parrot/utils/parsers/toml.cpython-311-x86_64-linux-gnu.so +0 -0
  100. parrot/utils/toml.py +11 -0
  101. parrot/utils/types.cpython-311-x86_64-linux-gnu.so +0 -0
  102. parrot/utils/uv.py +11 -0
  103. parrot/version.py +10 -0
  104. resources/users/__init__.py +5 -0
  105. resources/users/handlers.py +13 -0
  106. resources/users/models.py +205 -0
  107. settings/__init__.py +0 -0
  108. settings/settings.py +51 -0
parrot/utils/toml.py ADDED
@@ -0,0 +1,11 @@
1
+ from .parsers import TOMLParser
2
+
3
+
4
+ async def parse_toml_config(config_dir: str) -> dict:
5
+ try:
6
+ parser = TOMLParser()
7
+ return await parser.parse(config_dir)
8
+ except Exception as exc:
9
+ raise ValueError(
10
+ f"Error Parsing TOML Config on {config_dir}: {exc}"
11
+ )
parrot/utils/uv.py ADDED
@@ -0,0 +1,11 @@
1
+ import asyncio
2
+
3
+
4
+ def install_uvloop():
5
+ """install uvloop and set as default loop for asyncio."""
6
+ try:
7
+ import uvloop # noqa # pylint: disable=import-outside-toplevel
8
+ asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
9
+ uvloop.install()
10
+ except ImportError:
11
+ pass
parrot/version.py ADDED
@@ -0,0 +1,10 @@
1
+ """Nav Parrot Meta information."""
2
+
3
+ __title__ = "ai-parrot"
4
+ __description__ = "Live Chatbots based on Langchain chatbots and Agents \
5
+ Integrated into Navigator Framework or used into aiohttp applications."
6
+ __version__ = "0.1.0"
7
+ __author__ = "Jesus Lara"
8
+ __author_email__ = "jesuslarag@gmail.com"
9
+ __license__ = "MIT"
10
+ __copyright__ = 'Copyright (c) 2020-2024 Jesus Lara'
@@ -0,0 +1,5 @@
1
+ from .models import User, UserIdentity
2
+ from .handlers import ADUserHandler, ADPeopleHandler
3
+
4
+
5
+ __all__ = ('User', 'ADUserHandler', 'ADPeopleHandler', )
@@ -0,0 +1,13 @@
1
+ from datamodel import BaseModel
2
+ from navigator.views import ModelView
3
+ from .models import ADUser, ADPeople
4
+
5
+
6
+ class ADUserHandler(ModelView):
7
+ model: BaseModel = ADUser
8
+ pk: str = 'people_id'
9
+
10
+
11
+ class ADPeopleHandler(ModelView):
12
+ model: BaseModel = ADPeople
13
+ pk: str = 'people_id'
@@ -0,0 +1,205 @@
1
+ from typing import Optional, List
2
+ from datetime import datetime, timedelta
3
+ from uuid import UUID
4
+ from datamodel.types import Text
5
+ from asyncdb.models import Column, Model
6
+ from navigator_auth.conf import AUTH_DB_SCHEMA, AUTH_USERS_VIEW
7
+
8
+
9
+ class User(Model):
10
+ """Basic User notation."""
11
+
12
+ user_id: int = Column(
13
+ required=False,
14
+ primary_key=True,
15
+ db_default="auto"
16
+ )
17
+ first_name: str
18
+ last_name: str
19
+ display_name: str
20
+ email: str = Column(required=False, max=254)
21
+ alt_email: str = Column(required=False, max=254)
22
+ password: str = Column(required=False, max=128)
23
+ last_login: datetime = Column(required=False)
24
+ username: str = Column(required=False)
25
+ is_superuser: bool = Column(required=True, default=False)
26
+ is_active: bool = Column(required=True, default=True)
27
+ is_new: bool = Column(required=True, default=True)
28
+ is_staff: bool = Column(required=False, default=True)
29
+ title: str = Column(equired=False, max=90)
30
+ avatar: str = Column(max=512)
31
+ associate_id: str = Column(required=False)
32
+ associate_oid: str = Column(required=False)
33
+ department_code: str = Column(required=False)
34
+ job_code: str = Column(required=False)
35
+ position_id: str = Column(required=False)
36
+ group_id: list = Column(required=False)
37
+ groups: list = Column(required=False)
38
+ program_id: list = Column(required=False)
39
+ programs: list = Column(required=False)
40
+ start_date: datetime = Column(required=False)
41
+ birthday: str = Column(required=False)
42
+ worker_type: str = Column(required=False)
43
+ created_at: datetime = Column(required=False)
44
+
45
+ def birth_date(self):
46
+ if self.birthday:
47
+ _, month, day = self.birthday.split('-')
48
+ # Get the current year
49
+ current_year = datetime.now().year
50
+ # Create a new date string with the current year
51
+ new_date_str = f"{current_year}-{month}-{day}"
52
+ # Convert the new date string to a datetime object
53
+ return datetime.strptime(new_date_str, "%Y-%m-%d").date()
54
+ return None
55
+
56
+ def employment_duration(self):
57
+ if not self.start_date:
58
+ return None, None, None
59
+ # Get today's date
60
+ today = datetime.now().date()
61
+ # employment:
62
+ employment = self.start_date
63
+
64
+ # Calculate the difference in years, months, days
65
+ years = today.year - employment.year
66
+ months = today.month - employment.month
67
+ days = today.day - employment.day
68
+
69
+ # Adjust for cases where the current month is before the start month
70
+ if months < 0:
71
+ years -= 1
72
+ months += 12
73
+
74
+ # Adjust for cases where the current day
75
+ # is before the start day in the month
76
+ if days < 0:
77
+ # Subtract one month and calculate days based on the previous month
78
+ months -= 1
79
+ if months < 0:
80
+ years -= 1
81
+ months += 12
82
+ # Calculate the last day of the previous month
83
+ last_day_of_prev_month = (
84
+ today.replace(day=1) - timedelta(days=1)
85
+ ).day
86
+ days += last_day_of_prev_month
87
+
88
+ # Adjust months and years again if necessary
89
+ if months < 0:
90
+ years -= 1
91
+ months += 12
92
+
93
+ return years, months, days
94
+
95
+ class Meta:
96
+ driver = "pg"
97
+ name = AUTH_USERS_VIEW
98
+ schema = AUTH_DB_SCHEMA
99
+ description = 'View Model for getting Users.'
100
+ strict = True
101
+ frozen = False
102
+
103
+
104
+ class UserIdentity(Model):
105
+
106
+ identity_id: UUID = Column(
107
+ required=False,
108
+ primary_key=True,
109
+ db_default="auto",
110
+ repr=False
111
+ )
112
+ display_name: str = Column(required=False)
113
+ title: str = Column(required=False)
114
+ nickname: str = Column(required=False)
115
+ email: str = Column(required=False)
116
+ phone: str = Column(required=False)
117
+ short_bio: Text = Column(required=False)
118
+ avatar: str = Column(required=False)
119
+ user_id: User = Column(required=False, repr=False)
120
+ auth_provider: str = Column(required=False)
121
+ auth_data: Optional[dict] = Column(required=False, repr=False)
122
+ attributes: Optional[dict] = Column(required=False, repr=False)
123
+ created_at: datetime = Column(
124
+ required=False,
125
+ default=datetime.now(),
126
+ repr=False
127
+ )
128
+
129
+ class Meta:
130
+ driver = "pg"
131
+ name = "user_identities"
132
+ description = 'Manage User Identities.'
133
+ schema = AUTH_DB_SCHEMA
134
+ strict = True
135
+
136
+ class ADUser(Model):
137
+ """Active Directory Users."""
138
+ people_id: UUID = Column(
139
+ required=False,
140
+ primary_key=True,
141
+ db_default="auto",
142
+ repr=False
143
+ )
144
+ username: str = Column(required=False)
145
+ display_name: str = Column(required=False)
146
+ given_name: str = Column(required=False)
147
+ last_name: str = Column(required=False)
148
+ phones: Optional[list] = Column(required=False)
149
+ mobile: str = Column(required=False)
150
+ job_title: str = Column(required=False)
151
+ email: str = Column(required=False)
152
+ office_location: str = Column(required=False)
153
+ preferred_language: str = Column(required=False)
154
+ associate_id: str = Column(required=False)
155
+ associate_oid: str = Column(required=False)
156
+ job_code_title: str = Column(required=False)
157
+ position_id: str = Column(required=False)
158
+ zammad_created: bool = Column(required=False, default=False)
159
+ created_at: datetime = Column(
160
+ required=False,
161
+ default=datetime.now(),
162
+ repr=False
163
+ )
164
+
165
+ class Meta:
166
+ name = 'people'
167
+ schema = 'troc'
168
+ strict = True
169
+
170
+
171
+ class ADPeople(Model):
172
+ """Active Directory Users."""
173
+ people_id: UUID = Column(
174
+ required=False,
175
+ primary_key=True,
176
+ db_default="auto",
177
+ repr=False
178
+ )
179
+ user_id: int = Column(required=True)
180
+ userid: UUID = Column(required=False)
181
+ username: str = Column(required=False)
182
+ display_name: str = Column(required=False)
183
+ given_name: str = Column(required=False)
184
+ last_name: str = Column(required=False)
185
+ phones: Optional[list] = Column(required=False)
186
+ mobile: str = Column(required=False)
187
+ job_title: str = Column(required=False)
188
+ email: str = Column(required=False)
189
+ alt_email: str = Column(required=False)
190
+ office_location: str = Column(required=False)
191
+ preferred_language: str = Column(required=False)
192
+ associate_id: str = Column(required=False)
193
+ associate_oid: str = Column(required=False)
194
+ job_code_title: str = Column(required=False)
195
+ position_id: str = Column(required=False)
196
+ created_at: datetime = Column(
197
+ required=False,
198
+ default=datetime.now(),
199
+ repr=False
200
+ )
201
+
202
+ class Meta:
203
+ name = 'vw_people'
204
+ schema = 'troc'
205
+ strict = True
settings/__init__.py ADDED
File without changes
settings/settings.py ADDED
@@ -0,0 +1,51 @@
1
+ """
2
+ Settings Configuration for Parrot-AI.
3
+
4
+ Basic Configuration.
5
+ """
6
+ from navconfig import config, BASE_DIR
7
+ from navconfig.logging import logging
8
+
9
+
10
+ logging.getLogger(name='sentence_transformers').setLevel(logging.WARNING)
11
+
12
+ AUTHENTICATION_BACKENDS = (
13
+ 'navigator_auth.backends.AzureAuth',
14
+ 'navigator_auth.backends.APIKeyAuth',
15
+ 'navigator_auth.backends.TokenAuth',
16
+ 'navigator_auth.backends.TrocToken',
17
+ 'navigator_auth.backends.ADFSAuth',
18
+ 'navigator_auth.backends.Oauth2Provider',
19
+ 'navigator_auth.backends.BasicAuth'
20
+ )
21
+
22
+ # Azure Bot:
23
+ MS_TENANT_ID = config.get('MS_TENANT_ID')
24
+ MS_CLIENT_ID = config.get('MS_CLIENT_ID')
25
+ MS_CLIENT_SECRET = config.get('MS_CLIENT_SECRET')
26
+
27
+ # New Bot:
28
+ NEW_CLIENT_ID = config.get('NEW_CLIENT_ID')
29
+ NEW_CLIENT_SECRET = config.get('NEW_CLIENT_SECRET')
30
+
31
+ # Other Bots:
32
+ BOSE_CLIENT_ID = config.get('BOSE_CLIENT_ID')
33
+ BOSE_CLIENT_SECRET = config.get('BOSE_CLIENT_SECRET')
34
+ ODOO_CLIENT_ID = config.get('ODOO_CLIENT_ID')
35
+ ODOO_CLIENT_SECRET = config.get('ODOO_CLIENT_SECRET')
36
+ ASKBRETT_CLIENT_ID = config.get('ASKBRETT_CLIENT_ID')
37
+ ASKBRETT_CLIENT_SECRET = config.get('ASKBRETT_CLIENT_SECRET')
38
+ TROCERS_CLIENT_ID = config.get('TROCERS_CLIENT_ID')
39
+ TROCERS_CLIENT_SECRET = config.get('TROCERS_CLIENT_SECRET')
40
+ BOTTROCDEV_CLIENT_ID = config.get('BOTTROCDEV_CLIENT_ID')
41
+ BOTTROCDEV_CLIENT_SECRET = config.get('BOTTROCDEV_CLIENT_SECRET')
42
+ ATTBOT_CLIENT_ID = config.get('ATTBOT_CLIENT_ID')
43
+ ATTBOT_CLIENT_SECRET = config.get('ATTBOT_CLIENT_SECRET')
44
+
45
+
46
+ # ScyllaDB Configuration:
47
+ SCYLLADB_HOST = config.get('SCYLLADB_HOST', fallback='localhost')
48
+ SCYLLADB_PORT = int(config.get('SCYLLADB_PORT', fallback=9042))
49
+ SCYLLADB_USERNAME = config.get('SCYLLADB_USERNAME', fallback='navigator')
50
+ SCYLLADB_PASSWORD = config.get('SCYLLADB_PASSWORD', fallback='navigator')
51
+ SCYLLADB_KEYSPACE = config.get('SCYLLADB_KEYSPACE', fallback='navigator')