agently 4.0.6__py3-none-any.whl → 4.0.6.7__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.
- agently/builtins/plugins/ModelRequester/OpenAICompatible.py +9 -5
- agently/builtins/plugins/PromptGenerator/AgentlyPromptGenerator.py +4 -16
- agently/builtins/plugins/ToolManager/AgentlyToolManager.py +15 -2
- agently/core/ModelRequest.py +1 -2
- agently/integrations/chromadb.py +216 -19
- agently/types/data/tool.py +2 -2
- agently/utils/DataFormatter.py +25 -15
- agently/utils/Storage.py +9 -3
- agently/utils/__init__.py +2 -1
- {agently-4.0.6.dist-info → agently-4.0.6.7.dist-info}/METADATA +2 -3
- {agently-4.0.6.dist-info → agently-4.0.6.7.dist-info}/RECORD +13 -13
- {agently-4.0.6.dist-info → agently-4.0.6.7.dist-info}/WHEEL +0 -0
- {agently-4.0.6.dist-info → agently-4.0.6.7.dist-info}/licenses/LICENSE +0 -0
|
@@ -351,13 +351,13 @@ class OpenAICompatible(ModelRequester):
|
|
|
351
351
|
api_key = self.plugin_settings.get("api_key", None)
|
|
352
352
|
if api_key is not None and auth["api_key"] == "None":
|
|
353
353
|
auth["api_key"] = str(api_key)
|
|
354
|
-
if "
|
|
355
|
-
headers_with_auth = {**request_data.headers, "Authorization": f"Bearer { auth['api_key'] }"}
|
|
356
|
-
elif "headers" in auth and isinstance(auth["headers"], dict):
|
|
354
|
+
if "headers" in auth and isinstance(auth["headers"], dict):
|
|
357
355
|
headers_with_auth = {**request_data.headers, **auth["headers"]}
|
|
358
356
|
elif "body" in auth and isinstance(auth["body"], dict):
|
|
359
357
|
headers_with_auth = request_data.headers.copy()
|
|
360
358
|
request_data.data.update(**auth["body"])
|
|
359
|
+
if "api_key" in auth and auth["api_key"] != "None":
|
|
360
|
+
headers_with_auth = {**request_data.headers, "Authorization": f"Bearer { auth['api_key'] }"}
|
|
361
361
|
else:
|
|
362
362
|
headers_with_auth = request_data.headers.copy()
|
|
363
363
|
|
|
@@ -391,7 +391,9 @@ class OpenAICompatible(ModelRequester):
|
|
|
391
391
|
# Raise status code >= 400
|
|
392
392
|
if response.status_code >= 400:
|
|
393
393
|
e = RequestError(
|
|
394
|
-
f"Status Code: { response.status_code }\n"
|
|
394
|
+
f"Status Code: { response.status_code }\n"
|
|
395
|
+
f"Detail: { response.text }\n"
|
|
396
|
+
f"Request Data: {full_request_data}"
|
|
395
397
|
)
|
|
396
398
|
self._messenger.error(
|
|
397
399
|
e,
|
|
@@ -461,7 +463,9 @@ class OpenAICompatible(ModelRequester):
|
|
|
461
463
|
)
|
|
462
464
|
if response.status_code >= 400:
|
|
463
465
|
e = RequestError(
|
|
464
|
-
f"Status Code: { response.status_code }\n"
|
|
466
|
+
f"Status Code: { response.status_code }\n"
|
|
467
|
+
f"Detail: { response.text }\n"
|
|
468
|
+
f"Request Data: {full_request_data}"
|
|
465
469
|
)
|
|
466
470
|
self._messenger.error(
|
|
467
471
|
e,
|
|
@@ -307,9 +307,7 @@ class AgentlyPromptGenerator(PromptGenerator):
|
|
|
307
307
|
if isinstance(role_mapping, dict):
|
|
308
308
|
merged_role_mapping.update(role_mapping)
|
|
309
309
|
|
|
310
|
-
prompt_text_list.append(
|
|
311
|
-
f"{ (merged_role_mapping['user'] if 'user' in merged_role_mapping else 'user').upper() }:"
|
|
312
|
-
)
|
|
310
|
+
prompt_text_list.append(f"{ (merged_role_mapping['user'] if 'user' in merged_role_mapping else 'user') }:")
|
|
313
311
|
|
|
314
312
|
# system & developer
|
|
315
313
|
if prompt_object.system:
|
|
@@ -368,7 +366,7 @@ class AgentlyPromptGenerator(PromptGenerator):
|
|
|
368
366
|
|
|
369
367
|
prompt_text_list.extend(self._generate_main_prompt(prompt_object))
|
|
370
368
|
prompt_text_list.append(
|
|
371
|
-
f"{ (merged_role_mapping['assistant'] if 'assistant' in merged_role_mapping else 'assistant')
|
|
369
|
+
f"{ (merged_role_mapping['assistant'] if 'assistant' in merged_role_mapping else 'assistant') }:"
|
|
372
370
|
)
|
|
373
371
|
|
|
374
372
|
return "\n".join(prompt_text_list)
|
|
@@ -398,12 +396,7 @@ class AgentlyPromptGenerator(PromptGenerator):
|
|
|
398
396
|
if prompt_object.system:
|
|
399
397
|
prompt_messages.append(
|
|
400
398
|
self._generate_yaml_prompt_message(
|
|
401
|
-
|
|
402
|
-
prompt_title_mapping.get(
|
|
403
|
-
'system',
|
|
404
|
-
'SYSTEM',
|
|
405
|
-
)
|
|
406
|
-
),
|
|
399
|
+
"system",
|
|
407
400
|
prompt_object.system,
|
|
408
401
|
role_mapping=merged_role_mapping,
|
|
409
402
|
)
|
|
@@ -412,12 +405,7 @@ class AgentlyPromptGenerator(PromptGenerator):
|
|
|
412
405
|
if prompt_object.developer:
|
|
413
406
|
prompt_messages.append(
|
|
414
407
|
self._generate_yaml_prompt_message(
|
|
415
|
-
|
|
416
|
-
prompt_title_mapping.get(
|
|
417
|
-
'developer',
|
|
418
|
-
'DEVELOPER DIRECTIONS',
|
|
419
|
-
)
|
|
420
|
-
),
|
|
408
|
+
"developer",
|
|
421
409
|
prompt_object.developer,
|
|
422
410
|
role_mapping=merged_role_mapping,
|
|
423
411
|
)
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
import json
|
|
16
16
|
import inspect
|
|
17
17
|
|
|
18
18
|
from typing import (
|
|
@@ -206,6 +206,7 @@ class AgentlyToolManager(ToolManager):
|
|
|
206
206
|
):
|
|
207
207
|
async def _call_mcp_tool(**kwargs):
|
|
208
208
|
from fastmcp import Client
|
|
209
|
+
from mcp.types import TextContent, ImageContent, AudioContent, ResourceLink, EmbeddedResource
|
|
209
210
|
|
|
210
211
|
async with Client(transport) as client: # type: ignore
|
|
211
212
|
mcp_result = await client.call_tool(
|
|
@@ -216,7 +217,19 @@ class AgentlyToolManager(ToolManager):
|
|
|
216
217
|
if mcp_result.is_error:
|
|
217
218
|
return {"error": mcp_result.content[0].text} # type: ignore
|
|
218
219
|
else:
|
|
219
|
-
|
|
220
|
+
if mcp_result.structured_content:
|
|
221
|
+
return mcp_result.structured_content
|
|
222
|
+
try:
|
|
223
|
+
result = mcp_result.content[0]
|
|
224
|
+
if isinstance(result, TextContent):
|
|
225
|
+
try:
|
|
226
|
+
return json.loads(result.text)
|
|
227
|
+
except json.decoder.JSONDecodeError:
|
|
228
|
+
return result.text
|
|
229
|
+
elif isinstance(result, (ImageContent, AudioContent, ResourceLink, EmbeddedResource)):
|
|
230
|
+
return result.model_dump()
|
|
231
|
+
except:
|
|
232
|
+
return None
|
|
220
233
|
|
|
221
234
|
return _call_mcp_tool
|
|
222
235
|
|
agently/core/ModelRequest.py
CHANGED
|
@@ -99,7 +99,6 @@ class ModelResponse:
|
|
|
99
99
|
self.plugin_manager,
|
|
100
100
|
self.settings,
|
|
101
101
|
)
|
|
102
|
-
self.get_result = self.result
|
|
103
102
|
self.get_meta = self.result.get_meta
|
|
104
103
|
self.async_get_meta = self.result.async_get_meta
|
|
105
104
|
self.get_text = self.result.get_text
|
|
@@ -406,7 +405,7 @@ class ModelRequest:
|
|
|
406
405
|
self.prompt.clear()
|
|
407
406
|
return response
|
|
408
407
|
|
|
409
|
-
|
|
408
|
+
def get_result(self):
|
|
410
409
|
return self.get_response().result
|
|
411
410
|
|
|
412
411
|
async def async_get_meta(self):
|
agently/integrations/chromadb.py
CHANGED
|
@@ -2,18 +2,34 @@ from agently.utils import LazyImport
|
|
|
2
2
|
|
|
3
3
|
LazyImport.import_package("chromadb")
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
from typing import Literal, Callable, TypedDict, Any, TYPE_CHECKING, overload
|
|
6
|
+
from itertools import zip_longest
|
|
6
7
|
|
|
7
|
-
from chromadb
|
|
8
|
+
from chromadb import Client as ChromaDBClient
|
|
9
|
+
from chromadb.config import Settings
|
|
10
|
+
from chromadb.api.types import EmbeddingFunction
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
from
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from chromadb.api.types import (
|
|
14
|
+
Documents,
|
|
15
|
+
Embedding,
|
|
16
|
+
Embeddings,
|
|
17
|
+
QueryResult,
|
|
18
|
+
Schema,
|
|
19
|
+
DataLoader,
|
|
20
|
+
Loadable,
|
|
21
|
+
Where,
|
|
22
|
+
WhereDocument,
|
|
23
|
+
)
|
|
24
|
+
from chromadb.api.collection_configuration import CreateCollectionConfiguration
|
|
25
|
+
from chromadb.api import ClientAPI
|
|
26
|
+
from agently.core import BaseAgent
|
|
11
27
|
|
|
12
28
|
|
|
13
29
|
class ChromaDataDictOptional(TypedDict, total=False):
|
|
14
30
|
metadata: dict[Any, Any]
|
|
15
31
|
id: Any
|
|
16
|
-
embedding: Embedding
|
|
32
|
+
embedding: "Embedding"
|
|
17
33
|
|
|
18
34
|
|
|
19
35
|
class ChromaDataDict(ChromaDataDictOptional):
|
|
@@ -25,15 +41,15 @@ class ChromaData:
|
|
|
25
41
|
self,
|
|
26
42
|
original_data: ChromaDataDict | list[ChromaDataDict],
|
|
27
43
|
*,
|
|
28
|
-
embedding_function: Callable[[str | list[str]], Embeddings] | None = None,
|
|
29
|
-
agent: BaseAgent | None = None,
|
|
44
|
+
embedding_function: "Callable[[str | list[str]], Embeddings] | None" = None,
|
|
45
|
+
agent: "BaseAgent | None" = None,
|
|
30
46
|
):
|
|
31
47
|
self._original_data = original_data if isinstance(original_data, list) else [original_data]
|
|
32
48
|
if embedding_function:
|
|
33
49
|
self._embedding_function = embedding_function
|
|
34
50
|
elif agent:
|
|
35
51
|
|
|
36
|
-
def embedding_function_by_agent(texts: str | list[str]) -> Embeddings:
|
|
52
|
+
def embedding_function_by_agent(texts: str | list[str]) -> "Embeddings":
|
|
37
53
|
return agent.input(texts).start()
|
|
38
54
|
|
|
39
55
|
self._embedding_function = embedding_function_by_agent
|
|
@@ -65,22 +81,203 @@ class ChromaData:
|
|
|
65
81
|
return self._original_data
|
|
66
82
|
|
|
67
83
|
|
|
68
|
-
class
|
|
84
|
+
class ChromaResults:
|
|
69
85
|
def __init__(
|
|
70
|
-
self,
|
|
86
|
+
self,
|
|
87
|
+
*,
|
|
88
|
+
queries: str | list[str],
|
|
89
|
+
results: "QueryResult",
|
|
90
|
+
distance: float | None = None,
|
|
71
91
|
):
|
|
72
|
-
if
|
|
73
|
-
|
|
74
|
-
elif agent:
|
|
92
|
+
if isinstance(queries, str):
|
|
93
|
+
queries = [queries]
|
|
75
94
|
|
|
76
|
-
|
|
77
|
-
|
|
95
|
+
ids = results.get("ids") or []
|
|
96
|
+
documents = results.get("documents")
|
|
97
|
+
metadatas = results.get("metadatas")
|
|
98
|
+
distances = results.get("distances")
|
|
78
99
|
|
|
79
|
-
|
|
80
|
-
else:
|
|
100
|
+
if ids and len(queries) != len(ids):
|
|
81
101
|
raise ValueError(
|
|
82
|
-
f"
|
|
102
|
+
f"The length of queries does not equal the length of results['ids'].\nQueries: {queries}\nIds: {ids}"
|
|
83
103
|
)
|
|
84
104
|
|
|
85
|
-
|
|
105
|
+
self._chroma_results = results
|
|
106
|
+
self._results: dict[str, list[dict]] = {}
|
|
107
|
+
|
|
108
|
+
doc_iter = documents if documents is not None else []
|
|
109
|
+
meta_iter = metadatas if metadatas is not None else []
|
|
110
|
+
dist_iter = distances if distances is not None else []
|
|
111
|
+
|
|
112
|
+
for query, row_ids, row_documents, row_metadatas, row_distances in zip_longest(
|
|
113
|
+
queries, ids, doc_iter, meta_iter, dist_iter, fillvalue=None
|
|
114
|
+
):
|
|
115
|
+
row_ids = row_ids or []
|
|
116
|
+
query_results: list[dict[str, Any]] = []
|
|
117
|
+
for id_, doc, meta, dist in zip_longest(
|
|
118
|
+
row_ids, row_documents or [], row_metadatas or [], row_distances or [], fillvalue=None
|
|
119
|
+
):
|
|
120
|
+
query_result = {"id": id_, "document": doc, "metadata": meta, "distance": dist}
|
|
121
|
+
if distance is None:
|
|
122
|
+
query_results.append(query_result)
|
|
123
|
+
else:
|
|
124
|
+
if isinstance(dist, (int, float)) and dist < distance:
|
|
125
|
+
query_results.append(query_result)
|
|
126
|
+
|
|
127
|
+
if query:
|
|
128
|
+
self._results[query] = query_results
|
|
129
|
+
|
|
130
|
+
def get_original_results(self):
|
|
131
|
+
return self._chroma_results
|
|
132
|
+
|
|
133
|
+
def get(self, *, simplify_single_result: bool = False):
|
|
134
|
+
if simplify_single_result:
|
|
135
|
+
results = list(self._results.values())
|
|
136
|
+
if len(results) == 1:
|
|
137
|
+
return results[0]
|
|
138
|
+
return self._results
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class ChromaEmbeddingFunction(EmbeddingFunction):
|
|
142
|
+
def __init__(
|
|
143
|
+
self,
|
|
144
|
+
*,
|
|
145
|
+
embedding_agent: "BaseAgent",
|
|
146
|
+
):
|
|
147
|
+
def embedding_function_by_agent(texts: list[str]) -> "Embeddings":
|
|
148
|
+
return embedding_agent.input(texts).start()
|
|
149
|
+
|
|
150
|
+
self.embedding_function = embedding_function_by_agent
|
|
151
|
+
|
|
152
|
+
def __call__(self, documents: "Documents | list[str] | str") -> "Embeddings":
|
|
153
|
+
if isinstance(documents, str):
|
|
154
|
+
documents = [documents]
|
|
86
155
|
return self.embedding_function([document for document in documents])
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class ChromaCollection:
|
|
159
|
+
|
|
160
|
+
def __init__(
|
|
161
|
+
self,
|
|
162
|
+
collection_name: str,
|
|
163
|
+
*,
|
|
164
|
+
conn: "ClientAPI | None" = None,
|
|
165
|
+
schema: "Schema | None" = None,
|
|
166
|
+
configuration: "CreateCollectionConfiguration | None" = None,
|
|
167
|
+
metadata: dict[str, Any] | None = None,
|
|
168
|
+
embedding_agent: "BaseAgent | None" = None,
|
|
169
|
+
data_loader: "DataLoader[Loadable] | None" = None,
|
|
170
|
+
get_or_create: bool = False,
|
|
171
|
+
hnsw_space: Literal["l2", "cosine", "ip"] = "cosine",
|
|
172
|
+
):
|
|
173
|
+
if conn is None:
|
|
174
|
+
conn = ChromaDBClient(Settings(anonymized_telemetry=False))
|
|
175
|
+
|
|
176
|
+
if metadata is None:
|
|
177
|
+
metadata = {}
|
|
178
|
+
|
|
179
|
+
metadata["hnsw:space"] = hnsw_space
|
|
180
|
+
|
|
181
|
+
self.embedding_function = (
|
|
182
|
+
ChromaEmbeddingFunction(embedding_agent=embedding_agent) if embedding_agent is not None else None
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
self._collection = conn.create_collection(
|
|
186
|
+
collection_name,
|
|
187
|
+
schema=schema,
|
|
188
|
+
configuration=configuration,
|
|
189
|
+
metadata=metadata,
|
|
190
|
+
embedding_function=self.embedding_function,
|
|
191
|
+
data_loader=data_loader,
|
|
192
|
+
get_or_create=get_or_create,
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
def add(
|
|
196
|
+
self,
|
|
197
|
+
data: ChromaDataDict | list[ChromaDataDict] | ChromaData,
|
|
198
|
+
*,
|
|
199
|
+
embedding_function: "Callable[[str | list[str]], Embeddings] | None" = None,
|
|
200
|
+
):
|
|
201
|
+
embedding_function = embedding_function or self.embedding_function
|
|
202
|
+
if embedding_function is None:
|
|
203
|
+
raise NotImplementedError(
|
|
204
|
+
f"Embedding function must be assigned either in ChromaCollection initialize or .add() method."
|
|
205
|
+
)
|
|
206
|
+
if not isinstance(data, ChromaData):
|
|
207
|
+
data = ChromaData(data, embedding_function=embedding_function)
|
|
208
|
+
self._collection.add(**data.get_kwargs())
|
|
209
|
+
return self
|
|
210
|
+
|
|
211
|
+
@overload
|
|
212
|
+
def query(
|
|
213
|
+
self,
|
|
214
|
+
query_or_queries: str,
|
|
215
|
+
*,
|
|
216
|
+
embedding_function: "Callable[[str | list[str]], Embeddings] | None" = None,
|
|
217
|
+
top_n: int | None = None,
|
|
218
|
+
where: "Where | None" = None,
|
|
219
|
+
where_document: "WhereDocument | None" = None,
|
|
220
|
+
distance: float | None = None,
|
|
221
|
+
) -> list[dict[str, Any]]: ...
|
|
222
|
+
|
|
223
|
+
@overload
|
|
224
|
+
def query(
|
|
225
|
+
self,
|
|
226
|
+
query_or_queries: list[str],
|
|
227
|
+
*,
|
|
228
|
+
embedding_function: "Callable[[str | list[str]], Embeddings] | None" = None,
|
|
229
|
+
top_n: int | None = None,
|
|
230
|
+
where: "Where | None" = None,
|
|
231
|
+
where_document: "WhereDocument | None" = None,
|
|
232
|
+
distance: float | None = None,
|
|
233
|
+
) -> dict[str, list[dict[str, Any]]]: ...
|
|
234
|
+
|
|
235
|
+
def query(
|
|
236
|
+
self,
|
|
237
|
+
query_or_queries: str | list[str],
|
|
238
|
+
*,
|
|
239
|
+
embedding_function: "Callable[[str | list[str]], Embeddings] | None" = None,
|
|
240
|
+
top_n: int | None = None,
|
|
241
|
+
where: "Where | None" = None,
|
|
242
|
+
where_document: "WhereDocument | None" = None,
|
|
243
|
+
distance: float | None = None,
|
|
244
|
+
):
|
|
245
|
+
embedding_function = embedding_function or self.embedding_function
|
|
246
|
+
if embedding_function is None:
|
|
247
|
+
raise NotImplementedError(
|
|
248
|
+
f"Embedding function must be assigned either in ChromaCollection initialize or .query() method."
|
|
249
|
+
)
|
|
250
|
+
if not isinstance(query_or_queries, list):
|
|
251
|
+
query_or_queries = [query_or_queries]
|
|
252
|
+
return ChromaResults(
|
|
253
|
+
queries=query_or_queries,
|
|
254
|
+
results=self._collection.query(
|
|
255
|
+
query_embeddings=embedding_function(query_or_queries),
|
|
256
|
+
n_results=top_n or 10,
|
|
257
|
+
where=where,
|
|
258
|
+
where_document=where_document,
|
|
259
|
+
),
|
|
260
|
+
distance=distance,
|
|
261
|
+
).get(simplify_single_result=True)
|
|
262
|
+
|
|
263
|
+
def query_embeddings(
|
|
264
|
+
self,
|
|
265
|
+
embeddings_dict: dict[str, "Embedding"],
|
|
266
|
+
*,
|
|
267
|
+
top_n: int | None = None,
|
|
268
|
+
where: "Where | None" = None,
|
|
269
|
+
where_document: "WhereDocument | None" = None,
|
|
270
|
+
distance: float | None = None,
|
|
271
|
+
):
|
|
272
|
+
queries = [query for query in embeddings_dict.keys()]
|
|
273
|
+
embeddings = [embeddings for embeddings in embeddings_dict.values()]
|
|
274
|
+
return ChromaResults(
|
|
275
|
+
queries=queries,
|
|
276
|
+
results=self._collection.query(
|
|
277
|
+
query_embeddings=embeddings,
|
|
278
|
+
n_results=top_n or 10,
|
|
279
|
+
where=where,
|
|
280
|
+
where_document=where_document,
|
|
281
|
+
),
|
|
282
|
+
distance=distance,
|
|
283
|
+
).get(simplify_single_result=True)
|
agently/types/data/tool.py
CHANGED
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
from typing import Literal, Callable, TypeAlias
|
|
16
|
+
from typing import Any, Literal, Callable, TypeAlias
|
|
17
17
|
from typing_extensions import TypedDict, NotRequired
|
|
18
18
|
from pydantic import AnyUrl
|
|
19
19
|
from httpx import Auth, AsyncClient
|
|
20
20
|
|
|
21
|
-
ArgumentDesc: TypeAlias = type | str | tuple[str | type, str]
|
|
21
|
+
ArgumentDesc: TypeAlias = type | str | tuple[str | type | Any, str]
|
|
22
22
|
KwargsType: TypeAlias = dict[str, ArgumentDesc]
|
|
23
23
|
ReturnType: TypeAlias = KwargsType | ArgumentDesc | dict[str, "ReturnType"] | list["ReturnType"]
|
|
24
24
|
|
agently/utils/DataFormatter.py
CHANGED
|
@@ -218,21 +218,31 @@ class DataFormatter:
|
|
|
218
218
|
raise KeyError(f"Cannot find key 'type' in input schema: { input_schema }")
|
|
219
219
|
if input_schema["type"] != "object":
|
|
220
220
|
raise TypeError(f"Input schema type is not 'object' but: { input_schema['type'] }")
|
|
221
|
-
|
|
222
|
-
raise KeyError(f"Cannot find key 'properties' in input schema: { input_schema }")
|
|
223
|
-
properties = input_schema["properties"]
|
|
221
|
+
|
|
224
222
|
kwargs_format: "KwargsType" = {}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
223
|
+
|
|
224
|
+
if "properties" in input_schema and input_schema["properties"]:
|
|
225
|
+
properties = input_schema["properties"]
|
|
226
|
+
for kwarg_name, kwarg_schema in properties.items():
|
|
227
|
+
kwarg_type = kwarg_schema.pop("type", Any)
|
|
228
|
+
kwarg_schema.pop("title", None)
|
|
229
|
+
kwarg_desc = ";".join([f"{k}: {v}" for k, v in kwarg_schema.items()]) if kwarg_schema else ""
|
|
230
|
+
kwargs_format[kwarg_name] = (kwarg_type, kwarg_desc)
|
|
231
|
+
|
|
232
|
+
if "additionalProperties" in input_schema:
|
|
233
|
+
additional_properties = input_schema["additionalProperties"]
|
|
234
|
+
if additional_properties is True or additional_properties is None:
|
|
235
|
+
kwargs_format["<*>"] = (Any, "")
|
|
229
236
|
else:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
additional_type = additional_properties.pop("type", Any)
|
|
238
|
+
additional_properties.pop("title", None)
|
|
239
|
+
additional_desc = (
|
|
240
|
+
";".join([f"{k}: {v}" for k, v in additional_properties.items()])
|
|
241
|
+
if additional_properties
|
|
242
|
+
else ""
|
|
243
|
+
)
|
|
244
|
+
kwargs_format["<*>"] = (additional_type, additional_desc)
|
|
245
|
+
|
|
246
|
+
return kwargs_format or None
|
|
247
|
+
|
|
238
248
|
return None
|
agently/utils/Storage.py
CHANGED
|
@@ -25,9 +25,15 @@ from typing import (
|
|
|
25
25
|
)
|
|
26
26
|
from contextlib import asynccontextmanager
|
|
27
27
|
|
|
28
|
-
from
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
from .LazyImport import LazyImport
|
|
29
|
+
|
|
30
|
+
LazyImport.import_package("sqlmodel")
|
|
31
|
+
LazyImport.import_package("sqlalchemy")
|
|
32
|
+
LazyImport.import_package("aiosqlite")
|
|
33
|
+
|
|
34
|
+
from sqlmodel import SQLModel, select, inspect, create_engine, Session # type: ignore
|
|
35
|
+
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker # type: ignore
|
|
36
|
+
from sqlalchemy.sql import ColumnElement # type: ignore
|
|
31
37
|
|
|
32
38
|
from .RuntimeData import RuntimeData
|
|
33
39
|
|
agently/utils/__init__.py
CHANGED
|
@@ -17,7 +17,8 @@ from .Messenger import create_messenger
|
|
|
17
17
|
from .RuntimeData import RuntimeData, RuntimeDataNamespace
|
|
18
18
|
from .SerializableRuntimeData import SerializableRuntimeData, SerializableRuntimeDataNamespace
|
|
19
19
|
from .Settings import Settings, SettingsNamespace
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
# from .Storage import Storage, AsyncStorage
|
|
21
22
|
from .FunctionShifter import FunctionShifter
|
|
22
23
|
from .DataFormatter import DataFormatter
|
|
23
24
|
from .DataPathBuilder import DataPathBuilder
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agently
|
|
3
|
-
Version: 4.0.6
|
|
3
|
+
Version: 4.0.6.7
|
|
4
4
|
Summary:
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -14,14 +14,13 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
-
Requires-Dist: aiosqlite (>=0.21.0,<0.22.0)
|
|
18
17
|
Requires-Dist: greenlet (>=3.2.3,<4.0.0)
|
|
19
18
|
Requires-Dist: httpx (>=0.28.1,<0.29.0)
|
|
20
19
|
Requires-Dist: httpx-sse (>=0.4.1,<0.5.0)
|
|
21
20
|
Requires-Dist: json5 (>=0.12.0,<0.13.0)
|
|
21
|
+
Requires-Dist: packaging (>=25.0,<26.0)
|
|
22
22
|
Requires-Dist: pydantic (>=2.11.7,<3.0.0)
|
|
23
23
|
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
24
|
-
Requires-Dist: sqlmodel (>=0.0.24,<0.0.25)
|
|
25
24
|
Requires-Dist: stamina (>=25.1.0,<26.0.0)
|
|
26
25
|
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
|
27
26
|
Description-Content-Type: text/markdown
|
|
@@ -11,10 +11,10 @@ agently/builtins/agent_extensions/__init__.py,sha256=IxWRQogF8PCVNXeY7D4qhGukEx3
|
|
|
11
11
|
agently/builtins/hookers/ConsoleHooker.py,sha256=aJdDj_nG8CiwyelA505zvtpzBSwD52nFIkBRDJGgq3Y,8099
|
|
12
12
|
agently/builtins/hookers/PureLoggerHooker.py,sha256=fzN0OfhQzgns4KeCNH-qcdm-BdQT0W2kqEmt3Zp2pYI,1906
|
|
13
13
|
agently/builtins/hookers/SystemMessageHooker.py,sha256=nU5rOzcuXKdaTXWix3jhZ-4QoD4cMQJZo02wNTpZpjI,5396
|
|
14
|
-
agently/builtins/plugins/ModelRequester/OpenAICompatible.py,sha256=
|
|
15
|
-
agently/builtins/plugins/PromptGenerator/AgentlyPromptGenerator.py,sha256=
|
|
14
|
+
agently/builtins/plugins/ModelRequester/OpenAICompatible.py,sha256=xX-iy3qgToD8jIrPsL1NufMb6dlf0SVmX0rPjAkPSQ0,25261
|
|
15
|
+
agently/builtins/plugins/PromptGenerator/AgentlyPromptGenerator.py,sha256=KMlXKH44MExTaGnu5cmLtvYT3aXOQiXOZN-F4JeVnJE,28514
|
|
16
16
|
agently/builtins/plugins/ResponseParser/AgentlyResponseParser.py,sha256=FEhfsiHB4Bx7HfghnObklLj08j8IVwGh0WEVD6U-G3U,17445
|
|
17
|
-
agently/builtins/plugins/ToolManager/AgentlyToolManager.py,sha256=
|
|
17
|
+
agently/builtins/plugins/ToolManager/AgentlyToolManager.py,sha256=oaqte5LAryZQMD6vuEbKhe6kOLUyZTRZswC1MDFiYxw,9138
|
|
18
18
|
agently/builtins/plugins/__init__.py,sha256=wj4_U9TTekc2CmjppbXKUREDFRXFX1y0ySOW-CxQuok,801
|
|
19
19
|
agently/builtins/tools/Browse.py,sha256=gIePs-gtsqOI_ZTReGqEcoKvhs4FkBzTxow--QS5_ek,3469
|
|
20
20
|
agently/builtins/tools/Search.py,sha256=tUynNiW_ZMAGaB2ua3HRcY_trIbLEoASFE-p2QMQ0Zg,7362
|
|
@@ -22,7 +22,7 @@ agently/builtins/tools/__init__.py,sha256=pFOWgH2C3xRvgQo3UVdkj4yHjF9nNtmoVHmOZf
|
|
|
22
22
|
agently/core/Agent.py,sha256=HbUqlCWFgtziavN8r-2RFQyrbHMMxKA6y-io-0CY8TA,9022
|
|
23
23
|
agently/core/EventCenter.py,sha256=sknU5w9MpGDQgMOF9c5k4PfM4SNT5X_LrpYte2HaFNM,10861
|
|
24
24
|
agently/core/ExtensionHandlers.py,sha256=88iSAW50bgMshB56cTgKg30eOjZQyXiJY1en4w7afWY,2076
|
|
25
|
-
agently/core/ModelRequest.py,sha256=
|
|
25
|
+
agently/core/ModelRequest.py,sha256=rB8LQ2_7TJlOHZQ6jIKSfXDDQar7dv_bi8g7xpIoUN4,17355
|
|
26
26
|
agently/core/PluginManager.py,sha256=oUnXbe1ilQTOWwnENxtGtV6wG-yZriCxniqfuxuTFO0,4354
|
|
27
27
|
agently/core/Prompt.py,sha256=8SlqytnAIM_FIWbY2Jx-T7yOs_jqmkz9cux8-2iOCjA,8023
|
|
28
28
|
agently/core/Tool.py,sha256=PNYf_BwVefr8IOqf5asLaVq2fU7hQaFJwJVj3S4fq84,1871
|
|
@@ -37,7 +37,7 @@ agently/core/TriggerFlow/process/ForEachProcess.py,sha256=oBI7KIpnj2tbczt_cTJCNv
|
|
|
37
37
|
agently/core/TriggerFlow/process/MatchCaseProcess.py,sha256=-NpbAlXq054juNkFCsDdWsIBMoHHKV1-cEsgndcd9KY,7888
|
|
38
38
|
agently/core/TriggerFlow/process/__init__.py,sha256=BP5bAr9LRVVD83KFqXeprgTmXA1iCSOSsD509BtoX_E,753
|
|
39
39
|
agently/core/__init__.py,sha256=CPglSpW5oEEmWpCpdvv9wK4myXmVipjuZm5HtMq6Vxo,1214
|
|
40
|
-
agently/integrations/chromadb.py,sha256=
|
|
40
|
+
agently/integrations/chromadb.py,sha256=hLrjwsU_d4SOGRX0bf-55uiA73YarIzRa8ORFnwu3W8,9797
|
|
41
41
|
agently/types/__init__.py,sha256=xb8GMY-ULncO_PY9rfRUsyi12wAQQJx8gAAnoM30uZA,592
|
|
42
42
|
agently/types/data/__init__.py,sha256=qladqSEqcAUW_XzdTDl4cvaraq_DpANy3aZbIPxoygk,1627
|
|
43
43
|
agently/types/data/event.py,sha256=LFQW7MN_QGOis3XV-8K6jNXWsLvT7tYxo4BZbUBCpfI,1790
|
|
@@ -45,7 +45,7 @@ agently/types/data/prompt.py,sha256=DiszVM_3OHe66waf-99mBH7bzRr0cpbCHSpDI-2EjPs,
|
|
|
45
45
|
agently/types/data/request.py,sha256=Do-9g5QxZRMYjaoHCZYwHbj28r-t4noAAtOebw764P4,1924
|
|
46
46
|
agently/types/data/response.py,sha256=vjKIILaVyd5TVz5nvmytVRJPZg-RP0sRydhg_AzU6y0,3700
|
|
47
47
|
agently/types/data/serializable.py,sha256=v2KlyKNOKp4L6J_Ueupb-gCyrnngvBskFUwNPSJQgnA,844
|
|
48
|
-
agently/types/data/tool.py,sha256=
|
|
48
|
+
agently/types/data/tool.py,sha256=wE8Dda2JtY5cojpHUuQrw7PNeVZ6Zma968bn-pUmS7I,1529
|
|
49
49
|
agently/types/plugins/EventHooker.py,sha256=kb80-baVc3fVlrddW5syv9uSD8a2Mcw8Fd3I2HQhY_Y,1030
|
|
50
50
|
agently/types/plugins/ModelRequester.py,sha256=urG1zFX0b4U6ZKSO50IbW5IHK3ydmRgUom7O7Niqk8s,3875
|
|
51
51
|
agently/types/plugins/PromptGenerator.py,sha256=45jmVzAkyl1Yj2M8RVfQM_zFAJZP4zrPuQkHbWIQSRQ,4531
|
|
@@ -55,7 +55,7 @@ agently/types/plugins/__init__.py,sha256=gz_EpgBQGndIQHY5vJB2YRzAN5yIb3FZZG7pC8l
|
|
|
55
55
|
agently/types/plugins/base.py,sha256=AoNLwsH5IZBQt7_NZfxMWMhAk6PJSOFHR0IYOXp1imI,1167
|
|
56
56
|
agently/types/trigger_flow/__init__.py,sha256=Gj31SmWBC4qtrOqQedyGsnCfeSkUf3XvZNFrJ2QbMNw,777
|
|
57
57
|
agently/types/trigger_flow/trigger_flow.py,sha256=uDUZiila_4Rr41zUlzR4QqaRaraC43XTFfj-jnnG2G0,3787
|
|
58
|
-
agently/utils/DataFormatter.py,sha256=
|
|
58
|
+
agently/utils/DataFormatter.py,sha256=0P92t81vnp-rJSJvlbTF3yM-PRiteB19BNEQ8cmvmns,9444
|
|
59
59
|
agently/utils/DataLocator.py,sha256=ss8OLet9HN0U1PZb-OCHS6KL54kv7vFZph6G0-GBidk,6015
|
|
60
60
|
agently/utils/DataPathBuilder.py,sha256=sEzE1i2EWn7NMkCCXDT50gR6_qMzcZ0y0YGkYbXdB3s,10007
|
|
61
61
|
agently/utils/FunctionShifter.py,sha256=quwugTmf-vzHzRR_2wdv14AxLpr0lwxdUtVoX7Jeq48,5839
|
|
@@ -66,11 +66,11 @@ agently/utils/Messenger.py,sha256=dLasJvDt1HxJttt6X9dutwGPvyAtL7yp6BZ3TDxuFDI,72
|
|
|
66
66
|
agently/utils/RuntimeData.py,sha256=SewZ8D1fljuDwfVZTAqZ0XTNEcU2cuAr7QlVqk0vzrE,21925
|
|
67
67
|
agently/utils/SerializableRuntimeData.py,sha256=bVVwin50VnOs30W881ClFepSXAK8GCOUZnVd-SiolRw,3314
|
|
68
68
|
agently/utils/Settings.py,sha256=_s300H2doCMKcvMAmFwW3cLQqmd0N8BVmb226tAfVec,5294
|
|
69
|
-
agently/utils/Storage.py,sha256=
|
|
69
|
+
agently/utils/Storage.py,sha256=E7QyNJ9T0yOUafPgdP90La698hgLMSGjhJ7qCEHzxxw,9438
|
|
70
70
|
agently/utils/StreamingJSONCompleter.py,sha256=aZ9zuGUTQlP-QKbXHUZCf6EtVuG49MKn8xdhw0VhDEA,4292
|
|
71
71
|
agently/utils/StreamingJSONParser.py,sha256=sPPJOtj5OYvsrukRErcoxRl4yuV1zDuf7pQ_pvw_Zow,21116
|
|
72
|
-
agently/utils/__init__.py,sha256=
|
|
73
|
-
agently-4.0.6.dist-info/METADATA,sha256=
|
|
74
|
-
agently-4.0.6.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
75
|
-
agently-4.0.6.dist-info/licenses/LICENSE,sha256=Y5ZgAdYgMFigPT8dhN18dTLRtBshOSfWhTDRO1t0Cq4,11360
|
|
76
|
-
agently-4.0.6.dist-info/RECORD,,
|
|
72
|
+
agently/utils/__init__.py,sha256=7MDln5OVkqFEdhhuG8VTdr2q02UWwCj-udndwzWV_iQ,1280
|
|
73
|
+
agently-4.0.6.7.dist-info/METADATA,sha256=LZiqVCSE6wlDUhct8N33KtNf1M8Qs8aWFQHCCB3oAmo,7112
|
|
74
|
+
agently-4.0.6.7.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
75
|
+
agently-4.0.6.7.dist-info/licenses/LICENSE,sha256=Y5ZgAdYgMFigPT8dhN18dTLRtBshOSfWhTDRO1t0Cq4,11360
|
|
76
|
+
agently-4.0.6.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|