autonomous-app 0.3.5__py3-none-any.whl → 0.3.24__py3-none-any.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.
@@ -43,14 +43,17 @@ class AutoAuth:
43
43
  )
44
44
 
45
45
  @classmethod
46
- def current_user(cls):
46
+ def current_user(cls, pk=None):
47
47
  """
48
48
  Returns the current user.
49
49
  """
50
+ if pk:
51
+ user = cls.user_class.get(pk)
52
+ elif session.get("user"):
53
+ user = cls.user_class.from_json(session["user"])
54
+ else:
55
+ user = None
50
56
 
51
- user = (
52
- cls.user_class.from_json(session["user"]) if session.get("user") else None
53
- )
54
57
  if not user or user.state != "authenticated":
55
58
  user = cls.user_class.get_guest()
56
59
  return user
autonomous/auth/user.py CHANGED
@@ -42,13 +42,13 @@ class AutoUser(AutoModel):
42
42
  log(email, user)
43
43
  if not user:
44
44
  log(f"Creating new user for {email}")
45
- # user = cls(name=name, email=email)
46
-
45
+ user = cls(name=name, email=email)
47
46
  # parse user_info into a user object
48
47
  user.name = name
49
48
  user.email = email
50
49
  user.last_login = datetime.now()
51
50
  user.state = "authenticated"
51
+ user.role = "user"
52
52
  user.save()
53
53
  return user
54
54
 
@@ -173,11 +173,8 @@ class BaseField:
173
173
 
174
174
  # Get value from document instance if available
175
175
  result = instance._data.get(self.name)
176
- if not result:
177
- if self.default is not None:
178
- result = self.default
179
- if callable(result):
180
- result = result()
176
+ if result is None and self.default is not None:
177
+ result = self.default() if callable(self.default) else self.default
181
178
  return result
182
179
 
183
180
  def __set__(self, instance, value):
@@ -262,12 +259,6 @@ class BaseField:
262
259
  # next(iter) is useful for sets
263
260
  choice_list = [k for k, _ in choice_list]
264
261
 
265
- # log(
266
- # value,
267
- # type(value),
268
- # choice_list,
269
- # value in choice_list,
270
- # )
271
262
  # Choices which are other types of Documents
272
263
  if isinstance(value, (Document, EmbeddedDocument)):
273
264
  if not any(isinstance(value, c) for c in choice_list):
@@ -276,6 +267,7 @@ class BaseField:
276
267
  else:
277
268
  values = value if isinstance(value, (list, tuple)) else [value]
278
269
  if len(set(values) - set(choice_list)):
270
+ raise Exception(f"Value must be one of {choice_list}, not {value}")
279
271
  self.error("Value must be one of %s" % str(choice_list))
280
272
 
281
273
  def _validate(self, value, **kwargs):
@@ -2,7 +2,7 @@ import warnings
2
2
 
3
3
  from pymongo import MongoClient, ReadPreference, uri_parser
4
4
  from pymongo.common import _UUID_REPRESENTATIONS
5
- from pymongo.database import _check_name
5
+ from pymongo.database_shared import _check_name
6
6
 
7
7
  # DriverInfo was added in PyMongo 3.7.
8
8
  try:
autonomous/db/document.py CHANGED
@@ -417,7 +417,6 @@ class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass):
417
417
  if self._meta.get("abstract"):
418
418
  raise InvalidDocumentError("Cannot save an abstract document.")
419
419
  signals.pre_save.send(self.__class__, document=self, **signal_kwargs)
420
-
421
420
  if validate:
422
421
  self.validate(clean=clean)
423
422
 
autonomous/db/fields.py CHANGED
@@ -721,8 +721,7 @@ class EmbeddedDocumentField(BaseField):
721
721
  or issubclass(document_type, EmbeddedDocument)
722
722
  ):
723
723
  self.error(
724
- "Invalid embedded document class provided to an "
725
- "EmbeddedDocumentField"
724
+ "Invalid embedded document class provided to an EmbeddedDocumentField"
726
725
  )
727
726
 
728
727
  self.document_type_obj = document_type
@@ -1483,21 +1482,22 @@ class GenericReferenceField(BaseField):
1483
1482
  )
1484
1483
 
1485
1484
  def _validate_choices(self, value):
1486
- # log(value, self.null)
1487
1485
  if not value and self.null:
1488
1486
  return
1489
1487
  elif isinstance(value, dict):
1490
1488
  # If the field has not been dereferenced, it is still a dict
1491
1489
  # of class and DBRef
1492
- value = value.get("_cls")
1493
- elif isinstance(value, Document):
1490
+ # value = value.get("_cls")
1491
+ try:
1492
+ value = self._lazy_load_ref(
1493
+ get_document(value.get("_cls")), value.get("_ref")
1494
+ )
1495
+ except DoesNotExist:
1496
+ # log(f"{value} DoesNotExist")
1497
+ return
1498
+
1499
+ if isinstance(value, Document):
1494
1500
  mro = [cls.__name__ for cls in value.__class__.mro()]
1495
- # log(
1496
- # value,
1497
- # mro,
1498
- # self.choices,
1499
- # _print=True,
1500
- # )
1501
1501
  base_value = None
1502
1502
  for choice in self.choices:
1503
1503
  if choice in mro:
@@ -1510,19 +1510,8 @@ class GenericReferenceField(BaseField):
1510
1510
  f"Invalid Model Type. Must be or derive from on of: {self.choices}, not: {value} for attribute {self.name}"
1511
1511
  )
1512
1512
  else:
1513
- # log(
1514
- # value,
1515
- # type(value),
1516
- # "!!!! Need to update to this !!!!",
1517
- # _print=True,
1518
- # )
1519
1513
  value = value.__class__.__name__
1520
- # log(
1521
- # value,
1522
- # self.choices,
1523
- # type(value),
1524
- # _print=True,
1525
- # )
1514
+ # log(value, type(value))
1526
1515
  super()._validate_choices(value)
1527
1516
 
1528
1517
  @staticmethod
@@ -117,10 +117,7 @@ class BaseQuerySet:
117
117
  if q_obj:
118
118
  # Make sure proper query object is passed.
119
119
  if not isinstance(q_obj, QNode):
120
- msg = (
121
- "Not a query object: %s. "
122
- "Did you intend to use key=value?" % q_obj
123
- )
120
+ msg = "Not a query object: %s. Did you intend to use key=value?" % q_obj
124
121
  raise InvalidQueryError(msg)
125
122
  query &= q_obj
126
123
 
@@ -1,3 +1,4 @@
1
+ from autonomous import log
1
2
  from autonomous.db.errors import OperationError
2
3
  from autonomous.db.queryset.base import (
3
4
  CASCADE,
@@ -4,6 +4,7 @@ import pymongo
4
4
  from bson import SON, ObjectId
5
5
  from bson.dbref import DBRef
6
6
 
7
+ from autonomous import log
7
8
  from autonomous.db.base import UPDATE_OPERATORS
8
9
  from autonomous.db.common import _import_class
9
10
  from autonomous.db.errors import InvalidQueryError
@@ -76,14 +77,18 @@ def query(_doc_cls=None, **kwargs):
76
77
  """Transform a query from Django-style format to Mongo format."""
77
78
  mongo_query = {}
78
79
  merge_query = defaultdict(list)
80
+
81
+ # Iterate over sorted keyword arguments
79
82
  for key, value in sorted(kwargs.items()):
80
83
  if key == "__raw__":
81
84
  handle_raw_query(value, mongo_query)
82
85
  continue
83
86
 
87
+ # Split the key into parts based on '__'
84
88
  parts = key.rsplit("__")
85
89
  indices = [(i, p) for i, p in enumerate(parts) if p.isdigit()]
86
90
  parts = [part for part in parts if not part.isdigit()]
91
+
87
92
  # Check for an operator and transform to mongo-style if there is
88
93
  op = None
89
94
  if len(parts) > 1 and parts[-1] in MATCH_OPERATORS:
@@ -93,6 +98,7 @@ def query(_doc_cls=None, **kwargs):
93
98
  if len(parts) > 1 and parts[-1] == "":
94
99
  parts.pop()
95
100
 
101
+ # Check for negation
96
102
  negate = False
97
103
  if len(parts) > 1 and parts[-1] == "not":
98
104
  parts.pop()
@@ -115,7 +121,7 @@ def query(_doc_cls=None, **kwargs):
115
121
  if isinstance(field, str):
116
122
  parts.append(field)
117
123
  append_field = False
118
- # is last and CachedReferenceField
124
+ # Handle CachedReferenceField
119
125
  elif isinstance(field, CachedReferenceField) and fields[-1] == field:
120
126
  parts.append("%s._id" % field.db_field)
121
127
  else:
@@ -139,17 +145,14 @@ def query(_doc_cls=None, **kwargs):
139
145
  # Raise an error if the in/nin/all/near param is not iterable.
140
146
  value = _prepare_query_for_iterable(field, op, value)
141
147
 
142
- # If we're querying a GenericReferenceField, we need to alter the
143
- # key depending on the value:
144
- # * If the value is a DBRef, the key should be "field_name._ref".
145
- # * If the value is an ObjectId, the key should be "field_name._ref.$id".
148
+ # Handle GenericReferenceField
146
149
  if isinstance(field, GenericReferenceField):
147
150
  if isinstance(value, DBRef):
148
151
  parts[-1] += "._ref"
149
152
  elif isinstance(value, ObjectId):
150
153
  parts[-1] += "._ref.$id"
151
154
 
152
- # if op and op not in COMPARISON_OPERATORS:
155
+ # Handle different operators
153
156
  if op:
154
157
  if op in GEO_OPERATORS:
155
158
  value = _geo_operator(field, op, value)
@@ -166,9 +169,7 @@ def query(_doc_cls=None, **kwargs):
166
169
  value = field.prepare_query_value(op, value)
167
170
  value = {"$elemMatch": value}
168
171
  elif op in CUSTOM_OPERATORS:
169
- NotImplementedError(
170
- 'Custom method "%s" has not ' "been implemented" % op
171
- )
172
+ NotImplementedError('Custom method "%s" has not been implemented' % op)
172
173
  elif op not in STRING_OPERATORS:
173
174
  value = {"$" + op: value}
174
175
 
@@ -439,7 +440,7 @@ def _geo_operator(field, op, value):
439
440
  value = {"$within": {"$box": value}}
440
441
  else:
441
442
  raise NotImplementedError(
442
- 'Geo method "%s" has not been ' "implemented for a GeoPointField" % op
443
+ 'Geo method "%s" has not been implemented for a GeoPointField' % op
443
444
  )
444
445
  else:
445
446
  if op == "geo_within":
@@ -22,6 +22,9 @@ class StringAttr(StringField):
22
22
 
23
23
  class IntAttr(IntField):
24
24
  pass
25
+ # def __set__(self, instance, owner):
26
+ # results = super().__get__(instance, owner)
27
+ # return results
25
28
 
26
29
 
27
30
  class FloatAttr(FloatField):
@@ -53,7 +56,7 @@ class ReferenceAttr(GenericReferenceField):
53
56
  try:
54
57
  result = super().__get__(instance, owner)
55
58
  except DoesNotExist as e:
56
- log(f"ReferenceAttr Error: {e}")
59
+ # log(f"ReferenceAttr Error: {e}")
57
60
  return None
58
61
  return result
59
62
 
@@ -61,6 +64,13 @@ class ReferenceAttr(GenericReferenceField):
61
64
  class ListAttr(ListField):
62
65
  def __get__(self, instance, owner):
63
66
  results = super().__get__(instance, owner)
67
+
68
+ # sanity check
69
+ if not isinstance(results, list):
70
+ super().__set__(instance, [])
71
+ results = super().__get__(instance, owner)
72
+
73
+ # log(f"ListAttr: {results}")
64
74
  if isinstance(self.field, ReferenceAttr):
65
75
  i = 0
66
76
  while i < len(results):
@@ -75,9 +85,6 @@ class ListAttr(ListField):
75
85
  # log(f"Object Not Found: {results[i]}")
76
86
  return results
77
87
 
78
- # def append(self, obj):
79
- # results = super().__get__(instance, owner) or []
80
-
81
88
 
82
89
  class DictAttr(DictField):
83
90
  def __get__(self, instance, owner):
@@ -93,6 +100,16 @@ class DictAttr(DictField):
93
100
  results[key] = lazy_obj
94
101
  return results
95
102
 
103
+ # def __set__(self, instance, value):
104
+ # import traceback
105
+
106
+ # traceback.print_stack()
107
+
108
+ # log(value, instance.player_messages, _print=True)
109
+ # result = super().__set__(instance, value) or {}
110
+ # log(value, instance.player_messages, _print=True)
111
+ # return result
112
+
96
113
 
97
114
  class EnumAttr(EnumField):
98
115
  pass
@@ -1,4 +1,3 @@
1
- import importlib
2
1
  import os
3
2
  import urllib.parse
4
3
  from datetime import datetime
@@ -17,7 +16,6 @@ username = urllib.parse.quote_plus(str(os.getenv("DB_USERNAME")))
17
16
  dbname = os.getenv("DB_DB")
18
17
  # log(f"Connecting to MongoDB at {host}:{port} with {username}:{password} for {dbname}")
19
18
  connect(host=f"mongodb://{username}:{password}@{host}:{port}/{dbname}?authSource=admin")
20
- # log(f"{db}")
21
19
 
22
20
 
23
21
  class AutoModel(Document):
@@ -25,7 +23,30 @@ class AutoModel(Document):
25
23
  last_updated = DateTimeField(default=datetime.now)
26
24
 
27
25
  def __eq__(self, other):
28
- return self.pk == other.pk if other else False
26
+ return str(self.pk) == str(other.pk) if other else False
27
+
28
+ def __lt__(self, other):
29
+ return str(self.pk) < str(other.pk) if other else False
30
+
31
+ def __gt__(self, other):
32
+ return not (str(self.pk) < str(other.pk)) if other else False
33
+
34
+ def __le__(self, other):
35
+ return self < other or self == other
36
+
37
+ def __ge__(self, other):
38
+ return self > other or self == other
39
+
40
+ def __ne__(self, other):
41
+ return not self == other
42
+
43
+ def __hash__(self):
44
+ return hash(
45
+ (
46
+ self.model_name(),
47
+ self.pk,
48
+ )
49
+ )
29
50
 
30
51
  @classmethod
31
52
  def auto_pre_init(cls, sender, document, **kwargs):
@@ -65,13 +86,32 @@ class AutoModel(Document):
65
86
  f"{self.__module__}.{self._class_name}" if qualified else self._class_name
66
87
  )
67
88
 
89
+ @classmethod
90
+ def get_model(cls, model, pk=None):
91
+ try:
92
+ Model = cls.load_model(model)
93
+ except ValueError:
94
+ Model = None
95
+ return Model.get(pk) if Model and pk else Model
96
+
68
97
  @classmethod
69
98
  def load_model(cls, model):
70
- module_name, model = (
71
- model.rsplit(".", 1) if "." in model else (f"models.{model.lower()}", model)
72
- )
73
- module = importlib.import_module(module_name)
74
- return getattr(module, model)
99
+ if not isinstance(model, str):
100
+ return model
101
+
102
+ subclasses = AutoModel.__subclasses__()
103
+ visited_subclasses = []
104
+ while subclasses:
105
+ # log(subclasses, _print=True)
106
+ subclass = subclasses.pop()
107
+ if "_meta" in subclass.__dict__ and not subclass._meta.get("abstract"):
108
+ # log(f"Checking {subclass.__name__}", _print=True)
109
+ if subclass.__name__.lower() == model.lower():
110
+ return subclass
111
+ if subclass not in visited_subclasses:
112
+ subclasses += subclass.__subclasses__()
113
+ visited_subclasses += [subclass]
114
+ raise ValueError(f"Model {model} not found")
75
115
 
76
116
  @classmethod
77
117
  def get(cls, pk):
@@ -93,16 +133,21 @@ class AutoModel(Document):
93
133
  elif isinstance(pk, dict) and "$oid" in pk:
94
134
  pk = bson.ObjectId(pk["$oid"])
95
135
  try:
96
- return cls.objects.get(id=pk)
136
+ # log(pk, type(pk))
137
+ result = cls.objects.get(id=pk)
138
+ # log(result)
97
139
  except cls.DoesNotExist as e:
98
140
  log(f"Model {cls.__name__} with pk {pk} not found : {e}")
99
141
  return None
100
142
  except ValidationError as e:
143
+ # traceback.print_stack(limit=5)
101
144
  log(f"Model Validation failure {cls.__name__} [{pk}]: {e}")
102
145
  return None
103
146
  except Exception as e:
104
147
  log(f"Error getting model {cls.__name__} with pk {pk}: {e}", _print=True)
105
148
  raise e
149
+ else:
150
+ return result
106
151
 
107
152
  @classmethod
108
153
  def random(cls):
@@ -193,7 +238,6 @@ class AutoModel(Document):
193
238
  Returns:
194
239
  int: The primary key (pk) of the saved model.
195
240
  """
196
- # log(self.to_json())
197
241
  obj = super().save()
198
242
  self.pk = obj.pk
199
243
  return self.pk
@@ -1,40 +1,19 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: autonomous-app
3
- Version: 0.3.5
3
+ Version: 0.3.24
4
4
  Summary: Containerized application framework built on Flask with additional libraries and tools for rapid development of web applications.
5
5
  Author-email: Steven A Moore <samoore@binghamton.edu>
6
- License: MIT License
7
-
8
- Copyright (c) [2022] Steven Allen Moore
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
6
  Project-URL: homepage, https://github.com/Sallenmoore/autonomous
28
7
  Classifier: Programming Language :: Python :: 3.12
29
8
  Classifier: License :: OSI Approved :: MIT License
30
9
  Classifier: Operating System :: OS Independent
31
10
  Requires-Python: >=3.12
32
11
  Description-Content-Type: text/markdown
33
- License-File: LICENSE
34
12
  Requires-Dist: Flask
35
13
  Requires-Dist: setuptools
36
14
  Requires-Dist: python-dotenv
37
15
  Requires-Dist: blinker
16
+ Requires-Dist: pymongo
38
17
  Requires-Dist: PyGithub
39
18
  Requires-Dist: pygit2
40
19
  Requires-Dist: pillow
@@ -44,9 +23,12 @@ Requires-Dist: requests
44
23
  Requires-Dist: gunicorn
45
24
  Requires-Dist: Authlib
46
25
  Requires-Dist: rq
26
+ Requires-Dist: ollama
47
27
  Requires-Dist: openai>=1.42
28
+ Requires-Dist: google-genai
48
29
  Requires-Dist: dateparser
49
30
  Requires-Dist: python-slugify
31
+ Requires-Dist: pydub
50
32
 
51
33
  # Autonomous
52
34
 
@@ -1,32 +1,36 @@
1
- autonomous/__init__.py,sha256=Ie-rGZ4SZXAODsPeZELvNjjOd3RVllgErbeckM7K81E,94
1
+ autonomous/__init__.py,sha256=Dp6ufp5oFl0aEJai9_o6su3BGlw9k7kXY77oFPd7yEk,95
2
2
  autonomous/cli.py,sha256=z4AaGeWNW_uBLFAHng0J_lfS9v3fXemK1PeT85u4Eo4,42
3
3
  autonomous/logger.py,sha256=NQtgEaTWNAWfLSgqSP7ksXj1GpOuCgoUV711kSMm-WA,2022
4
4
  autonomous/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- autonomous/ai/audioagent.py,sha256=uZEhJ8_ctEvzshxJewaGdw-gh2Ts8lIcEysh0rlL62w,1040
6
- autonomous/ai/imageagent.py,sha256=Y3n4OFD-UC9lSg1j-U9wRnyLLaRl0LjibHbriJwYF2c,981
7
- autonomous/ai/jsonagent.py,sha256=P5HGuN7r7whgryZ2oCvSRY7jQlq0FdDK3-DtdnUG_N0,1321
8
- autonomous/ai/oaiagent.py,sha256=Zrd4iijGfkFsF1Dbhhj0SeHoezec3kae8CrFrZQeqXQ,1346
9
- autonomous/ai/textagent.py,sha256=pYzuoE7ENsxXjTSoVRMGvy7KQK0cS50SlWpY-1r7PiY,1220
5
+ autonomous/ai/audioagent.py,sha256=SvPLzKgqUnrkcsR7y93aURSrStIrryuntQMPS1SzUXw,1033
6
+ autonomous/ai/baseagent.py,sha256=HYCqC4HmK5afNMunmTkhRE8O0OaONl2GxXnISkdOM58,1094
7
+ autonomous/ai/imageagent.py,sha256=bIOrgg_CM-rgfyLme7V9vPqP8WKVMIAVoB2E9lLtIRk,521
8
+ autonomous/ai/jsonagent.py,sha256=a_l4HyyVRj3FB6py_P1xdc4Bj9uNI1YmJrWQXAksIvs,964
9
+ autonomous/ai/textagent.py,sha256=wI1-VC9zscKYyxYBg4pZ0ZyNJ5ZvKkLfWsIY1vJFChk,863
10
10
  autonomous/ai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- autonomous/ai/models/openai.py,sha256=npavtBRWaxZuO3EtdFK1pm64wporJcTb_JDdxhMyhPI,11732
11
+ autonomous/ai/models/aws.py,sha256=bGDjnGTm350zOqor9IsICzUkBUN2bubGI_ZssQuSXIw,12715
12
+ autonomous/ai/models/deepseek.py,sha256=fkoi-hJp60yFlZ9Cb9PdUrmNSErYltQ5ezkUI75llXc,2734
13
+ autonomous/ai/models/gemini.py,sha256=koyhxNQVYloYRdqFDKQZSJV0NVj0dVL88JV7F31irP0,11372
14
+ autonomous/ai/models/local.py,sha256=fkoi-hJp60yFlZ9Cb9PdUrmNSErYltQ5ezkUI75llXc,2734
15
+ autonomous/ai/models/openai.py,sha256=2-LttCm6woGklaLbs1H5LjlbfM-7leDwGmC9vksSqW4,13135
12
16
  autonomous/apis/version_control/GHCallbacks.py,sha256=AyiUlYfV5JePi11GVyqYyXoj5UTbPKzS-HRRI94rjJo,1069
13
17
  autonomous/apis/version_control/GHOrganization.py,sha256=mi2livdsGurKiifbvuLwiFbdDzL77IlEfhwEa-tG77I,1155
14
18
  autonomous/apis/version_control/GHRepo.py,sha256=hTFHMkxSbSlVELfh8S6mq6ijkIKPRQO-Q5775ZjRKD4,4622
15
19
  autonomous/apis/version_control/GHVersionControl.py,sha256=VIhVRxe6gJgozFWyhyKIu4spgSJI-GChiVJudnSyggI,196
16
20
  autonomous/apis/version_control/__init__.py,sha256=tP0bAWYl1RwBRi62HsIidmgyqHuSlCUqwGuKUKKRugc,117
17
21
  autonomous/auth/__init__.py,sha256=IW5tQ8VYwHIbDfMYA0wYgx4PprwcjUWV4EoIJ8HTlMU,161
18
- autonomous/auth/autoauth.py,sha256=6GFs8xikCvPYXZ29bbc5baf603QvnE8tZQIIrAfTziY,3624
22
+ autonomous/auth/autoauth.py,sha256=OizuMhmFjNzmsUijIbjGcQ5FxzVeoy9-NMFsx_TDsOE,3709
19
23
  autonomous/auth/github.py,sha256=dHf84bJdV9rXGcvRLzWCPW9CvuA-VEmqYi_QQFwd2kY,886
20
24
  autonomous/auth/google.py,sha256=cHmqbyNEPTKipc3WkYcD1XPOyqcWEFW0Ks4qJYmGvPw,1049
21
- autonomous/auth/user.py,sha256=t8R7KsHp-QK3B_OS5ERSnQ4P8Tnhjehhmdqp5gcKxuU,2702
25
+ autonomous/auth/user.py,sha256=1yDu04yNSURzBzok6C5Dn-_mv0fGefvjrxj9ikCktqY,2726
22
26
  autonomous/db/__init__.py,sha256=9frkXJrl_OUemUQteXCTPqC8ECyxjE91Gi2mgTq26Fw,1159
23
27
  autonomous/db/common.py,sha256=BUN2x_XuQBRFcq54TGPx4yLMLJdgytdbIt07QWr4CSM,2551
24
- autonomous/db/connection.py,sha256=IhfJ8H5SZ44z7ptEez3T8QUPk88en9s3y9eKIpnIfg4,17747
28
+ autonomous/db/connection.py,sha256=j_-eMre4ade9Y8GejJcMbQQiSEimL4j2vIQxaXViKxI,17754
25
29
  autonomous/db/context_managers.py,sha256=_nH2ajCL8Xy90AuB2rKaryR4iF8Q8ksU3Nei_mZj-DE,9918
26
30
  autonomous/db/dereference.py,sha256=EgbpPCXtDZqD_ZuY1Wd4o3ltRy8qEo3C5yRh5_c9fLE,12776
27
- autonomous/db/document.py,sha256=PGbCbkx3Los4zOj0Da6YcLCv_rR-xXp_7X6qivjAsL4,44429
31
+ autonomous/db/document.py,sha256=oZKdTaoqwv9fCHiv450rIxgINASQF3J9FzIsUOUXHhw,44428
28
32
  autonomous/db/errors.py,sha256=_QeCotid1kmr7_W0QyH6NUrwwYN9eced_yyyiop0Xlw,4108
29
- autonomous/db/fields.py,sha256=bAF2LSJ4Ys-eY89rKp1C9jIJjqtQnuDHNyig1tidSrc,93765
33
+ autonomous/db/fields.py,sha256=2SrsdCXQYnNg9bPfKs9CGa1mTnu6cQFqu0KyFPSamNA,93551
30
34
  autonomous/db/mongodb_support.py,sha256=u0X-zpqTIZZP8o2-IDyKRKHL8ALLhvW1VSGtK3fLyos,626
31
35
  autonomous/db/pymongo_support.py,sha256=UEZ4RHAGb_t1nuMUAJXMNs0vdH3dutxAH5mwFCmG6jI,2951
32
36
  autonomous/db/signals.py,sha256=BM-M4hh4SrTbV9bZVIEWTG8mxgKn9Lo2rC7owLJz4yQ,1791
@@ -34,27 +38,26 @@ autonomous/db/base/__init__.py,sha256=qbVw-SlbJxlWu8UoPLQcwyRQ7Oso0r3aUit6Jqpoz4
34
38
  autonomous/db/base/common.py,sha256=YjvDGwmn-QoRplL9Xx2q3eUXEetgo3YureIGxbR36Y8,1540
35
39
  autonomous/db/base/datastructures.py,sha256=fcgWe2JsfzTK3jbku3Teh0Iwvn5U5EhCpyeh9xr8bZ0,15850
36
40
  autonomous/db/base/document.py,sha256=OM7CeJFZbxha6yKMiMCrHOlTELfOXusqJ8i6FjdFd0c,46652
37
- autonomous/db/base/fields.py,sha256=o5XSMYm3NnpU5uw1hvqFFAZHcmJJwWxgwB_hq4sHkPI,29096
41
+ autonomous/db/base/fields.py,sha256=NorRXWR_NAJ1D2XkuICfEB6tM977-AaboYl3R2uSy8E,29001
38
42
  autonomous/db/base/metaclasses.py,sha256=GVvJYcCxaW1ltEqyH4oNvT_srckEXDSHOtHVU_TAN70,18138
39
43
  autonomous/db/base/utils.py,sha256=MH4FuEwh-5IcIinwNTkyTs-PqQLyyiMctcYMsNP85qk,617
40
44
  autonomous/db/queryset/__init__.py,sha256=XT3__0BJCvQIQj3S_Mp7mPxNBkfdvXkdw56cg2gc86o,756
41
- autonomous/db/queryset/base.py,sha256=RjxzR55i7pfj9yntMZ_dSTbXp0Ik6HA57tdQFCWXXk8,76103
45
+ autonomous/db/queryset/base.py,sha256=unJiIEwh7dtZblYeLHCvq6QkXm8CYsm09bMnPkNJUYc,76040
42
46
  autonomous/db/queryset/field_list.py,sha256=qY50kgMYzloZXrOXnWT0PS_fBJCoThSioRvW9-HmhYA,2964
43
47
  autonomous/db/queryset/manager.py,sha256=fXu95TlGChdJWTRA4OnY_Ik25JzezJ2_qPqmH78xJsY,2238
44
- autonomous/db/queryset/queryset.py,sha256=Xvt1q7Olij9STbJkHm6dKrUIrgyJeY_uwJOYE9WUZvk,5942
45
- autonomous/db/queryset/transform.py,sha256=UhBdDxYR_bWH0ECnaSw9g9YMwgWRZtsRl_q6PkqO9eY,19615
48
+ autonomous/db/queryset/queryset.py,sha256=SRLYWAQUXgcfNzeMPiH5Mm4WZIemHTNQ24y2EIisNQU,5969
49
+ autonomous/db/queryset/transform.py,sha256=IIZKf_io60zPTIwJ5KcPcrJOOOOjD2yQU7coYClL1Iw,19461
46
50
  autonomous/db/queryset/visitor.py,sha256=AN09lR6hWYUlKJC7G1sktvnWy5hrFnpoQhi58bOXbA4,5470
47
51
  autonomous/model/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
48
- autonomous/model/autoattr.py,sha256=o9KmWnqC33tvG-K2wGY3fwgd9FFIm5ivlRkMGqWqTIs,2132
49
- autonomous/model/automodel.py,sha256=Q5S84TsIXZT4r0AFQS6OQm4oRIMPWWfuUhD0i5gsm7s,6809
52
+ autonomous/model/autoattr.py,sha256=FUnQrw65CcZumYiTsQ7U6G6UDGqbeekka-cjz6Sfchc,2675
53
+ autonomous/model/automodel.py,sha256=F9rlsna1QYg8mVb-5ErKx5fEXxvaogVxWeeaJQBOOjs,8166
50
54
  autonomous/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
55
  autonomous/storage/imagestorage.py,sha256=SmBjBNBlP1ZEjxdOnGVzCHZhbEhMKTUQC2TbpWbejDE,6168
52
56
  autonomous/storage/localstorage.py,sha256=FzrR6O9mMGAZt5dDgqzkeOQVfGRXCygR0kksz2MPpwE,2286
53
57
  autonomous/tasks/__init__.py,sha256=pn7iZ14MhcHUdzcLkfkd4-45wgPP0tXahAz_cFgb_Tg,32
54
58
  autonomous/tasks/autotask.py,sha256=aK5iapDhgcAic3F5ZYMAhNKJkOepj8yWwbMizKDzUwQ,4153
55
59
  autonomous/utils/markdown.py,sha256=tf8vlHARiQO1X_aGbqlYozzP_TbdiDRT9EEP6aFRQo0,2153
56
- autonomous_app-0.3.5.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
57
- autonomous_app-0.3.5.dist-info/METADATA,sha256=kytfTSGcjr-XpafI0e0EHlS5vYvv2GBP3_r4Degu-_Y,4188
58
- autonomous_app-0.3.5.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
59
- autonomous_app-0.3.5.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
60
- autonomous_app-0.3.5.dist-info/RECORD,,
60
+ autonomous_app-0.3.24.dist-info/METADATA,sha256=Q1hOYw18UcWoGV8rrFT6_Qj09XmuFs9aGsA5XN27UPs,3015
61
+ autonomous_app-0.3.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
62
+ autonomous_app-0.3.24.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
63
+ autonomous_app-0.3.24.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
autonomous/ai/oaiagent.py DELETED
@@ -1,40 +0,0 @@
1
- from autonomous import log
2
- from autonomous.model.autoattr import ReferenceAttr
3
- from autonomous.model.automodel import AutoModel
4
-
5
- from .models.openai import OpenAIModel
6
-
7
-
8
- class OAIAgent(AutoModel):
9
- client_model = ReferenceAttr(choices=[OpenAIModel])
10
- _ai_model = OpenAIModel
11
-
12
- @property
13
- def client(self):
14
- if self.client_model is None:
15
- self.client_model = self._ai_model()
16
- self.save()
17
- return self.client_model
18
-
19
- def clear_files(self, file_id=None):
20
- return self.client.clear_files(file_id)
21
-
22
- def attach_file(self, file_contents, filename="dbdata.json"):
23
- return self.client.attach_file(file_contents, filename)
24
-
25
- def generate(self, messages, function=None, additional_instructions=""):
26
- if function is None:
27
- return self.client.generate_text(messages, additional_instructions)
28
- else:
29
- return self.client.generate_json(
30
- messages, function, additional_instructions
31
- )
32
-
33
- def generate_audio(self, prompt, file_path, **kwargs):
34
- return self.client.generate_audio(self, file_path, **kwargs)
35
-
36
- def generate_image(self, prompt, **kwargs):
37
- return self.client.generate_image(prompt, **kwargs)
38
-
39
- def summarize_text(self, text, primer=""):
40
- return self.client.generate_image(text, primer)
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) [2022] Steven Allen Moore
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.