agently 4.0.6.3__tar.gz → 4.0.6.5__tar.gz
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-4.0.6.3 → agently-4.0.6.5}/PKG-INFO +1 -1
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/plugins/ModelRequester/OpenAICompatible.py +6 -2
- agently-4.0.6.5/agently/integrations/chromadb.py +167 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/data/tool.py +2 -2
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/DataFormatter.py +25 -15
- {agently-4.0.6.3 → agently-4.0.6.5}/pyproject.toml +1 -1
- agently-4.0.6.3/agently/integrations/chromadb.py +0 -86
- {agently-4.0.6.3 → agently-4.0.6.5}/LICENSE +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/README.md +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/_default_init.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/_default_settings.yaml +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/base.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/agent_extensions/AutoFuncExtension.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/agent_extensions/ChatSessionExtension.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/agent_extensions/ConfigurePromptExtension.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/agent_extensions/KeyWaiterExtension.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/agent_extensions/ToolExtension.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/agent_extensions/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/hookers/ConsoleHooker.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/hookers/PureLoggerHooker.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/hookers/SystemMessageHooker.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/plugins/PromptGenerator/AgentlyPromptGenerator.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/plugins/ResponseParser/AgentlyResponseParser.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/plugins/ToolManager/AgentlyToolManager.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/plugins/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/tools/Browse.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/tools/Search.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/tools/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/Agent.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/EventCenter.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/ExtensionHandlers.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/ModelRequest.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/PluginManager.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/Prompt.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/Tool.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/BluePrint.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/Chunk.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/Execution.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/Process.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/TriggerFlow.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/process/BaseProcess.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/process/ForEachProcess.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/process/MatchCaseProcess.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/TriggerFlow/process/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/core/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/data/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/data/event.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/data/prompt.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/data/request.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/data/response.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/data/serializable.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/plugins/EventHooker.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/plugins/ModelRequester.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/plugins/PromptGenerator.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/plugins/ResponseParser.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/plugins/ToolManager.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/plugins/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/plugins/base.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/trigger_flow/__init__.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/types/trigger_flow/trigger_flow.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/DataLocator.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/DataPathBuilder.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/FunctionShifter.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/GeneratorConsumer.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/LazyImport.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/Logger.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/Messenger.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/RuntimeData.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/SerializableRuntimeData.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/Settings.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/Storage.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/StreamingJSONCompleter.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/StreamingJSONParser.py +0 -0
- {agently-4.0.6.3 → agently-4.0.6.5}/agently/utils/__init__.py +0 -0
{agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/plugins/ModelRequester/OpenAICompatible.py
RENAMED
|
@@ -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,
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
from agently.utils import LazyImport, FunctionShifter
|
|
2
|
+
|
|
3
|
+
LazyImport.import_package("chromadb")
|
|
4
|
+
|
|
5
|
+
from typing import Callable, TypedDict, Any, TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from chromadb.api.types import EmbeddingFunction, DefaultEmbeddingFunction
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from chromadb.api.types import (
|
|
11
|
+
Documents,
|
|
12
|
+
Embedding,
|
|
13
|
+
Embeddings,
|
|
14
|
+
QueryResult,
|
|
15
|
+
Schema,
|
|
16
|
+
CollectionMetadata,
|
|
17
|
+
DataLoader,
|
|
18
|
+
Loadable,
|
|
19
|
+
)
|
|
20
|
+
from chromadb.api.collection_configuration import CreateCollectionConfiguration
|
|
21
|
+
from chromadb.api import ClientAPI
|
|
22
|
+
from agently.core import BaseAgent
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ChromaDataDictOptional(TypedDict, total=False):
|
|
26
|
+
metadata: dict[Any, Any]
|
|
27
|
+
id: Any
|
|
28
|
+
embedding: "Embedding"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ChromaDataDict(ChromaDataDictOptional):
|
|
32
|
+
document: str
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ChromaData:
|
|
36
|
+
def __init__(
|
|
37
|
+
self,
|
|
38
|
+
original_data: ChromaDataDict | list[ChromaDataDict],
|
|
39
|
+
*,
|
|
40
|
+
embedding_function: "Callable[[str | list[str]], Embeddings] | None" = None,
|
|
41
|
+
agent: "BaseAgent | None" = None,
|
|
42
|
+
):
|
|
43
|
+
self._original_data = original_data if isinstance(original_data, list) else [original_data]
|
|
44
|
+
if embedding_function:
|
|
45
|
+
self._embedding_function = embedding_function
|
|
46
|
+
elif agent:
|
|
47
|
+
|
|
48
|
+
def embedding_function_by_agent(texts: str | list[str]) -> "Embeddings":
|
|
49
|
+
return agent.input(texts).start()
|
|
50
|
+
|
|
51
|
+
self._embedding_function = embedding_function_by_agent
|
|
52
|
+
else:
|
|
53
|
+
self._embedding_function = None
|
|
54
|
+
self._chroma_data = {
|
|
55
|
+
"documents": [],
|
|
56
|
+
"metadatas": [],
|
|
57
|
+
"ids": [],
|
|
58
|
+
"embeddings": [],
|
|
59
|
+
}
|
|
60
|
+
if self._embedding_function is not None:
|
|
61
|
+
documents = [data["document"] for data in self._original_data]
|
|
62
|
+
embeddings = self._embedding_function(documents)
|
|
63
|
+
self._chroma_data["embeddings"] = embeddings
|
|
64
|
+
for index, data in enumerate(self._original_data):
|
|
65
|
+
data["embedding"] = embeddings[index]
|
|
66
|
+
else:
|
|
67
|
+
del self._chroma_data["embeddings"]
|
|
68
|
+
for index, data in enumerate(self._original_data):
|
|
69
|
+
self._chroma_data["documents"].append(data["document"])
|
|
70
|
+
self._chroma_data["metadatas"].append(data["metadata"] if "metadata" in data else None)
|
|
71
|
+
self._chroma_data["ids"].append(data["id"] if "id" in data else str(index))
|
|
72
|
+
|
|
73
|
+
def get_kwargs(self):
|
|
74
|
+
return self._chroma_data
|
|
75
|
+
|
|
76
|
+
def get_original_data(self):
|
|
77
|
+
return self._original_data
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class ChromaResults:
|
|
81
|
+
def __init__(
|
|
82
|
+
self,
|
|
83
|
+
*,
|
|
84
|
+
queries: str | list[str],
|
|
85
|
+
results: "QueryResult",
|
|
86
|
+
):
|
|
87
|
+
if isinstance(queries, str):
|
|
88
|
+
queries = [queries]
|
|
89
|
+
if len(queries) != len(results["documents"] or []):
|
|
90
|
+
raise ValueError(
|
|
91
|
+
f"The length of queries does not equal the length of results.\nQueries: { queries }\nResults: { results }"
|
|
92
|
+
)
|
|
93
|
+
self._chroma_results = results
|
|
94
|
+
self._results = {}
|
|
95
|
+
for query_index, query in enumerate(queries):
|
|
96
|
+
for result_index, id in enumerate(results["ids"][query_index]):
|
|
97
|
+
result = {
|
|
98
|
+
"id": id,
|
|
99
|
+
"document": results["documents"][query_index][result_index] if results["documents"] else None,
|
|
100
|
+
"metadata": results["metadatas"][query_index][result_index] if results["metadatas"] else None,
|
|
101
|
+
"distance": results["distances"][query_index][result_index] if results["distances"] else None,
|
|
102
|
+
}
|
|
103
|
+
self._results[query] = result
|
|
104
|
+
|
|
105
|
+
def get_original_results(self):
|
|
106
|
+
return self._chroma_results
|
|
107
|
+
|
|
108
|
+
def get(self):
|
|
109
|
+
return self._results
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class ChromaEmbeddingFunction(EmbeddingFunction):
|
|
113
|
+
def __init__(
|
|
114
|
+
self,
|
|
115
|
+
*,
|
|
116
|
+
embedding_function: "Callable[[list[str]], Embeddings] | None" = None,
|
|
117
|
+
agent: "BaseAgent | None" = None,
|
|
118
|
+
):
|
|
119
|
+
if embedding_function:
|
|
120
|
+
self.embedding_function = embedding_function
|
|
121
|
+
elif agent:
|
|
122
|
+
|
|
123
|
+
def embedding_function_by_agent(texts: list[str]) -> "Embeddings":
|
|
124
|
+
return agent.input(texts).start()
|
|
125
|
+
|
|
126
|
+
self.embedding_function = embedding_function_by_agent
|
|
127
|
+
else:
|
|
128
|
+
raise ValueError(
|
|
129
|
+
f"ChromaEmbeddingFunction() requires at least one definition for 'embedding_function' or 'agent'."
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
def __call__(self, documents: "Documents") -> "Embeddings":
|
|
133
|
+
return self.embedding_function([document for document in documents])
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class ChromaCollection:
|
|
137
|
+
def __init__(
|
|
138
|
+
self,
|
|
139
|
+
conn: "ClientAPI",
|
|
140
|
+
collection_name: str,
|
|
141
|
+
*,
|
|
142
|
+
schema: "Schema | None" = None,
|
|
143
|
+
configuration: "CreateCollectionConfiguration | None" = None,
|
|
144
|
+
metadata: None = None,
|
|
145
|
+
embedding_function: EmbeddingFunction | None = None,
|
|
146
|
+
agent: "BaseAgent | None" = None,
|
|
147
|
+
data_loader: "DataLoader[Loadable] | None" = None,
|
|
148
|
+
get_or_create: bool = False,
|
|
149
|
+
):
|
|
150
|
+
if embedding_function:
|
|
151
|
+
self._embedding_function = embedding_function
|
|
152
|
+
elif agent:
|
|
153
|
+
self._embedding_function = ChromaEmbeddingFunction(agent=agent)
|
|
154
|
+
else:
|
|
155
|
+
self._embedding_function = DefaultEmbeddingFunction()
|
|
156
|
+
|
|
157
|
+
self._collection = conn.create_collection(
|
|
158
|
+
collection_name,
|
|
159
|
+
schema=schema,
|
|
160
|
+
configuration=configuration,
|
|
161
|
+
metadata=metadata,
|
|
162
|
+
embedding_function=embedding_function,
|
|
163
|
+
data_loader=data_loader,
|
|
164
|
+
get_or_create=get_or_create,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
def add(self): ...
|
|
@@ -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
|
|
|
@@ -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
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
from agently.utils import LazyImport
|
|
2
|
-
|
|
3
|
-
LazyImport.import_package("chromadb")
|
|
4
|
-
|
|
5
|
-
import json
|
|
6
|
-
|
|
7
|
-
from chromadb.api.types import EmbeddingFunction, Documents, Embedding, Embeddings
|
|
8
|
-
|
|
9
|
-
from typing import Callable, TypedDict, Any, cast
|
|
10
|
-
from agently.core import BaseAgent
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class ChromaDataDictOptional(TypedDict, total=False):
|
|
14
|
-
metadata: dict[Any, Any]
|
|
15
|
-
id: Any
|
|
16
|
-
embedding: Embedding
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class ChromaDataDict(ChromaDataDictOptional):
|
|
20
|
-
document: str
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class ChromaData:
|
|
24
|
-
def __init__(
|
|
25
|
-
self,
|
|
26
|
-
original_data: ChromaDataDict | list[ChromaDataDict],
|
|
27
|
-
*,
|
|
28
|
-
embedding_function: Callable[[str | list[str]], Embeddings] | None = None,
|
|
29
|
-
agent: BaseAgent | None = None,
|
|
30
|
-
):
|
|
31
|
-
self._original_data = original_data if isinstance(original_data, list) else [original_data]
|
|
32
|
-
if embedding_function:
|
|
33
|
-
self._embedding_function = embedding_function
|
|
34
|
-
elif agent:
|
|
35
|
-
|
|
36
|
-
def embedding_function_by_agent(texts: str | list[str]) -> Embeddings:
|
|
37
|
-
return agent.input(texts).start()
|
|
38
|
-
|
|
39
|
-
self._embedding_function = embedding_function_by_agent
|
|
40
|
-
else:
|
|
41
|
-
self._embedding_function = None
|
|
42
|
-
self._chroma_data = {
|
|
43
|
-
"documents": [],
|
|
44
|
-
"metadatas": [],
|
|
45
|
-
"ids": [],
|
|
46
|
-
"embeddings": [],
|
|
47
|
-
}
|
|
48
|
-
if self._embedding_function is not None:
|
|
49
|
-
documents = [data["document"] for data in self._original_data]
|
|
50
|
-
embeddings = self._embedding_function(documents)
|
|
51
|
-
self._chroma_data["embeddings"] = embeddings
|
|
52
|
-
for index, data in enumerate(self._original_data):
|
|
53
|
-
data["embedding"] = embeddings[index]
|
|
54
|
-
else:
|
|
55
|
-
del self._chroma_data["embeddings"]
|
|
56
|
-
for index, data in enumerate(self._original_data):
|
|
57
|
-
self._chroma_data["documents"].append(data["document"])
|
|
58
|
-
self._chroma_data["metadatas"].append(data["metadata"] if "metadata" in data else None)
|
|
59
|
-
self._chroma_data["ids"].append(data["id"] if "id" in data else str(index))
|
|
60
|
-
|
|
61
|
-
def get_kwargs(self):
|
|
62
|
-
return self._chroma_data
|
|
63
|
-
|
|
64
|
-
def get_original_data(self):
|
|
65
|
-
return self._original_data
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
class ChromaEmbeddingFunction(EmbeddingFunction):
|
|
69
|
-
def __init__(
|
|
70
|
-
self, *, embedding_function: Callable[[list[str]], Embeddings] | None = None, agent: BaseAgent | None = None
|
|
71
|
-
):
|
|
72
|
-
if embedding_function:
|
|
73
|
-
self.embedding_function = embedding_function
|
|
74
|
-
elif agent:
|
|
75
|
-
|
|
76
|
-
def embedding_function_by_agent(texts: list[str]) -> Embeddings:
|
|
77
|
-
return agent.input(texts).start()
|
|
78
|
-
|
|
79
|
-
self.embedding_function = embedding_function_by_agent
|
|
80
|
-
else:
|
|
81
|
-
raise ValueError(
|
|
82
|
-
f"ChromaEmbeddingFunction() requires at least one definition for 'embedding_function' or 'agent'."
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
def __call__(self, documents: Documents) -> Embeddings:
|
|
86
|
-
return self.embedding_function([document for document in documents])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/agent_extensions/ChatSessionExtension.py
RENAMED
|
File without changes
|
{agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/agent_extensions/ConfigurePromptExtension.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/plugins/ResponseParser/AgentlyResponseParser.py
RENAMED
|
File without changes
|
{agently-4.0.6.3 → agently-4.0.6.5}/agently/builtins/plugins/ToolManager/AgentlyToolManager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|