autonomous-app 0.3.10__py3-none-any.whl → 0.3.11__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.
- autonomous/__init__.py +1 -1
- autonomous/ai/audioagent.py +2 -16
- autonomous/ai/baseagent.py +18 -10
- autonomous/ai/imageagent.py +2 -16
- autonomous/ai/jsonagent.py +4 -18
- autonomous/ai/models/openai.py +7 -2
- autonomous/ai/textagent.py +4 -18
- {autonomous_app-0.3.10.dist-info → autonomous_app-0.3.11.dist-info}/METADATA +1 -1
- {autonomous_app-0.3.10.dist-info → autonomous_app-0.3.11.dist-info}/RECORD +12 -12
- {autonomous_app-0.3.10.dist-info → autonomous_app-0.3.11.dist-info}/LICENSE +0 -0
- {autonomous_app-0.3.10.dist-info → autonomous_app-0.3.11.dist-info}/WHEEL +0 -0
- {autonomous_app-0.3.10.dist-info → autonomous_app-0.3.11.dist-info}/top_level.txt +0 -0
autonomous/__init__.py
CHANGED
autonomous/ai/audioagent.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
from autonomous import log
|
|
2
2
|
from autonomous.model.autoattr import ReferenceAttr, StringAttr
|
|
3
|
-
from autonomous.
|
|
3
|
+
from autonomous.ai.baseagent import BaseAgent
|
|
4
4
|
|
|
5
5
|
from .models.openai import OpenAIModel
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class AudioAgent(
|
|
9
|
-
client = ReferenceAttr(choices=[OpenAIModel])
|
|
8
|
+
class AudioAgent(BaseAgent):
|
|
10
9
|
name = StringAttr(default="audioagent")
|
|
11
10
|
instructions = StringAttr(
|
|
12
11
|
default="You are highly skilled AI trained to assist with generating audio files."
|
|
@@ -15,18 +14,5 @@ class AudioAgent(AutoModel):
|
|
|
15
14
|
default="A helpful AI assistant trained to assist with generating audio files."
|
|
16
15
|
)
|
|
17
16
|
|
|
18
|
-
_ai_model = OpenAIModel
|
|
19
|
-
|
|
20
|
-
def get_client(self):
|
|
21
|
-
if self.client is None:
|
|
22
|
-
self.client = self._ai_model(
|
|
23
|
-
name=self.name,
|
|
24
|
-
instructions=self.instructions,
|
|
25
|
-
description=self.description,
|
|
26
|
-
)
|
|
27
|
-
self.client.save()
|
|
28
|
-
self.save()
|
|
29
|
-
return self.client
|
|
30
|
-
|
|
31
17
|
def generate(self, prompt, file_path, **kwargs):
|
|
32
18
|
return self.get_client().generate_audio(prompt, file_path, **kwargs)
|
autonomous/ai/baseagent.py
CHANGED
|
@@ -5,16 +5,24 @@ from autonomous.model.automodel import AutoModel
|
|
|
5
5
|
from .models.openai import OpenAIModel
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
class BaseAgent(AutoModel):
|
|
9
|
+
meta = {"abstract": True, "allow_inheritance": True, "strict": False}
|
|
10
|
+
|
|
11
|
+
client = ReferenceAttr(choices=[OpenAIModel])
|
|
12
|
+
|
|
13
|
+
_ai_model = OpenAIModel
|
|
14
|
+
|
|
15
|
+
def get_client(self):
|
|
16
|
+
if self.client is None:
|
|
17
|
+
self.client = self._ai_model(
|
|
18
|
+
name=self.name,
|
|
19
|
+
instructions=self.instructions,
|
|
20
|
+
description=self.description,
|
|
21
|
+
)
|
|
22
|
+
self.client.save()
|
|
23
|
+
self.save()
|
|
24
|
+
return self.client
|
|
25
|
+
|
|
18
26
|
|
|
19
27
|
# def clear_files(self, file_id=None):
|
|
20
28
|
# return self.client.clear_files(file_id)
|
autonomous/ai/imageagent.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
from autonomous.model.autoattr import ReferenceAttr, StringAttr
|
|
2
2
|
from autonomous.model.automodel import AutoModel
|
|
3
|
-
|
|
3
|
+
from autonomous.ai.baseagent import BaseAgent
|
|
4
4
|
from .models.openai import OpenAIModel
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class ImageAgent(
|
|
8
|
-
client = ReferenceAttr(choices=[OpenAIModel])
|
|
7
|
+
class ImageAgent(BaseAgent):
|
|
9
8
|
name = StringAttr(default="imageagent")
|
|
10
9
|
instructions = StringAttr(
|
|
11
10
|
default="You are highly skilled AI trained to assist with generating images."
|
|
@@ -14,18 +13,5 @@ class ImageAgent(AutoModel):
|
|
|
14
13
|
default="A helpful AI assistant trained to assist with generating images."
|
|
15
14
|
)
|
|
16
15
|
|
|
17
|
-
_ai_model = OpenAIModel
|
|
18
|
-
|
|
19
|
-
def get_client(self):
|
|
20
|
-
if self.client is None:
|
|
21
|
-
self.client = self._ai_model(
|
|
22
|
-
name=self.name,
|
|
23
|
-
instructions=self.instructions,
|
|
24
|
-
description=self.description,
|
|
25
|
-
)
|
|
26
|
-
self.client.save()
|
|
27
|
-
self.save()
|
|
28
|
-
return self.client
|
|
29
|
-
|
|
30
16
|
def generate(self, prompt, **kwargs):
|
|
31
17
|
return self.get_client().generate_image(prompt, **kwargs)
|
autonomous/ai/jsonagent.py
CHANGED
|
@@ -2,12 +2,11 @@ import json
|
|
|
2
2
|
|
|
3
3
|
from autonomous.model.autoattr import ReferenceAttr, StringAttr
|
|
4
4
|
from autonomous.model.automodel import AutoModel
|
|
5
|
-
|
|
5
|
+
from autonomous.ai.baseagent import BaseAgent
|
|
6
6
|
from .models.openai import OpenAIModel
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class JSONAgent(
|
|
10
|
-
client = ReferenceAttr(choices=[OpenAIModel])
|
|
9
|
+
class JSONAgent(BaseAgent):
|
|
11
10
|
name = StringAttr(default="jsonagent")
|
|
12
11
|
instructions = StringAttr(
|
|
13
12
|
default="You are highly skilled AI trained to assist with generating JSON formatted data."
|
|
@@ -16,24 +15,11 @@ class JSONAgent(AutoModel):
|
|
|
16
15
|
default="A helpful AI assistant trained to assist with generating JSON formatted data."
|
|
17
16
|
)
|
|
18
17
|
|
|
19
|
-
_ai_model = OpenAIModel
|
|
20
|
-
|
|
21
18
|
def clear_files(self, file_id=None):
|
|
22
|
-
return self.
|
|
19
|
+
return self.get_client().clear_files(file_id)
|
|
23
20
|
|
|
24
21
|
def attach_file(self, file_contents, filename="dbdata.json"):
|
|
25
|
-
return self.
|
|
26
|
-
|
|
27
|
-
def get_client(self):
|
|
28
|
-
if self.client is None:
|
|
29
|
-
self.client = self._ai_model(
|
|
30
|
-
name=self.name,
|
|
31
|
-
instructions=self.instructions,
|
|
32
|
-
description=self.description,
|
|
33
|
-
)
|
|
34
|
-
self.client.save()
|
|
35
|
-
self.save()
|
|
36
|
-
return self.client
|
|
22
|
+
return self.get_client().attach_file(file_contents, filename)
|
|
37
23
|
|
|
38
24
|
def generate(self, messages, function, additional_instructions=""):
|
|
39
25
|
result = self.get_client().generate_json(
|
autonomous/ai/models/openai.py
CHANGED
|
@@ -55,7 +55,11 @@ class OpenAIModel(AutoModel):
|
|
|
55
55
|
self.save()
|
|
56
56
|
|
|
57
57
|
def _get_agent_id(self):
|
|
58
|
-
|
|
58
|
+
try:
|
|
59
|
+
self.client.beta.assistants.retrieve(self.agent_id)
|
|
60
|
+
except openai.NotFoundError as e:
|
|
61
|
+
self.clear_files()
|
|
62
|
+
log("no agent found, creating a new one")
|
|
59
63
|
agent = self.client.beta.assistants.create(
|
|
60
64
|
instructions=self.instructions,
|
|
61
65
|
description=self.description,
|
|
@@ -183,7 +187,7 @@ IMPORTANT: Always use the function 'response' tool to respond to the user with o
|
|
|
183
187
|
]:
|
|
184
188
|
running_job = False
|
|
185
189
|
|
|
186
|
-
except openai.
|
|
190
|
+
except openai.BadRequestError as e:
|
|
187
191
|
# Handle specific bad request errors
|
|
188
192
|
error_message = e.json_body.get("error", {}).get("message", "")
|
|
189
193
|
if "already has an active run" in error_message:
|
|
@@ -226,6 +230,7 @@ IMPORTANT: Always use the function 'response' tool to respond to the user with o
|
|
|
226
230
|
return results
|
|
227
231
|
|
|
228
232
|
def generate_text(self, messages, additional_instructions=""):
|
|
233
|
+
self._get_agent_id()
|
|
229
234
|
formatted_messages = self._format_messages(messages)
|
|
230
235
|
thread = self.client.beta.threads.create(messages=formatted_messages)
|
|
231
236
|
|
autonomous/ai/textagent.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
from autonomous import log
|
|
2
2
|
from autonomous.model.autoattr import ReferenceAttr, StringAttr
|
|
3
3
|
from autonomous.model.automodel import AutoModel
|
|
4
|
-
|
|
4
|
+
from autonomous.ai.baseagent import BaseAgent
|
|
5
5
|
from .models.openai import OpenAIModel
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class TextAgent(
|
|
9
|
-
client = ReferenceAttr(choices=[OpenAIModel])
|
|
8
|
+
class TextAgent(BaseAgent):
|
|
10
9
|
name = StringAttr(default="textagent")
|
|
11
10
|
instructions = StringAttr(
|
|
12
11
|
default="You are highly skilled AI trained to assist with generating text according to the given requirements."
|
|
@@ -15,24 +14,11 @@ class TextAgent(AutoModel):
|
|
|
15
14
|
default="A helpful AI assistant trained to assist with generating text according to the given requirements."
|
|
16
15
|
)
|
|
17
16
|
|
|
18
|
-
_ai_model = OpenAIModel
|
|
19
|
-
|
|
20
17
|
def clear_files(self, file_id=None):
|
|
21
|
-
return self.
|
|
18
|
+
return self.get_client().clear_files(file_id)
|
|
22
19
|
|
|
23
20
|
def attach_file(self, file_contents, filename="dbdata.json"):
|
|
24
|
-
return self.
|
|
25
|
-
|
|
26
|
-
def get_client(self):
|
|
27
|
-
if self.client is None:
|
|
28
|
-
self.client = self._ai_model(
|
|
29
|
-
name=self.name,
|
|
30
|
-
instructions=self.instructions,
|
|
31
|
-
description=self.description,
|
|
32
|
-
)
|
|
33
|
-
self.client.save()
|
|
34
|
-
self.save()
|
|
35
|
-
return self.client
|
|
21
|
+
return self.get_client().attach_file(file_contents, filename)
|
|
36
22
|
|
|
37
23
|
def summarize_text(self, text, primer=""):
|
|
38
24
|
return self.get_client().summarize_text(text, primer)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: autonomous-app
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.11
|
|
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
6
|
License: MIT License
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
autonomous/__init__.py,sha256=
|
|
1
|
+
autonomous/__init__.py,sha256=LqPKmIGRGZ_91hBOzfCLYFqx_Af2TrUidswoUQeiBhQ,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=
|
|
6
|
-
autonomous/ai/baseagent.py,sha256=
|
|
7
|
-
autonomous/ai/imageagent.py,sha256=
|
|
8
|
-
autonomous/ai/jsonagent.py,sha256=
|
|
9
|
-
autonomous/ai/textagent.py,sha256=
|
|
5
|
+
autonomous/ai/audioagent.py,sha256=Vqh_1YxfZ1T7sU27BR06d_d618heA0mRlOa0440_NHs,635
|
|
6
|
+
autonomous/ai/baseagent.py,sha256=NE3OjDqu2e9Wy-cQEzzQoHPUrtFo__WPpPAN0v3zOxs,905
|
|
7
|
+
autonomous/ai/imageagent.py,sha256=Tn02Hk7WX53pqvK-2Xd2xOuyHKaNuAS_yr7lRdct3rc,624
|
|
8
|
+
autonomous/ai/jsonagent.py,sha256=wlTULEBlrAAb8ELMxik1b7YOgHD4ARmbWLUWc5pgxB8,1197
|
|
9
|
+
autonomous/ai/textagent.py,sha256=8iVuY-cSJsJgyWKrpCoj46c0MIsB13PFPNYdxSyqlKI,1096
|
|
10
10
|
autonomous/ai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
autonomous/ai/models/openai.py,sha256=
|
|
11
|
+
autonomous/ai/models/openai.py,sha256=fVfPsintow3fl7DVChMwcoiq83lpUZqFkNR7XBXJIZw,11870
|
|
12
12
|
autonomous/apis/version_control/GHCallbacks.py,sha256=AyiUlYfV5JePi11GVyqYyXoj5UTbPKzS-HRRI94rjJo,1069
|
|
13
13
|
autonomous/apis/version_control/GHOrganization.py,sha256=mi2livdsGurKiifbvuLwiFbdDzL77IlEfhwEa-tG77I,1155
|
|
14
14
|
autonomous/apis/version_control/GHRepo.py,sha256=hTFHMkxSbSlVELfh8S6mq6ijkIKPRQO-Q5775ZjRKD4,4622
|
|
@@ -53,8 +53,8 @@ autonomous/storage/localstorage.py,sha256=FzrR6O9mMGAZt5dDgqzkeOQVfGRXCygR0kksz2
|
|
|
53
53
|
autonomous/tasks/__init__.py,sha256=pn7iZ14MhcHUdzcLkfkd4-45wgPP0tXahAz_cFgb_Tg,32
|
|
54
54
|
autonomous/tasks/autotask.py,sha256=aK5iapDhgcAic3F5ZYMAhNKJkOepj8yWwbMizKDzUwQ,4153
|
|
55
55
|
autonomous/utils/markdown.py,sha256=tf8vlHARiQO1X_aGbqlYozzP_TbdiDRT9EEP6aFRQo0,2153
|
|
56
|
-
autonomous_app-0.3.
|
|
57
|
-
autonomous_app-0.3.
|
|
58
|
-
autonomous_app-0.3.
|
|
59
|
-
autonomous_app-0.3.
|
|
60
|
-
autonomous_app-0.3.
|
|
56
|
+
autonomous_app-0.3.11.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
|
|
57
|
+
autonomous_app-0.3.11.dist-info/METADATA,sha256=V2_Kp07O8jKpLexpAT-hcg8-phZQ2U8ZO5gbCshDbSE,4189
|
|
58
|
+
autonomous_app-0.3.11.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
59
|
+
autonomous_app-0.3.11.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
|
|
60
|
+
autonomous_app-0.3.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|