ursa-ai 0.2.10__py3-none-any.whl → 0.2.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.
Potentially problematic release.
This version of ursa-ai might be problematic. Click here for more details.
- ursa/util/memory_logger.py +17 -8
- {ursa_ai-0.2.10.dist-info → ursa_ai-0.2.11.dist-info}/METADATA +1 -1
- {ursa_ai-0.2.10.dist-info → ursa_ai-0.2.11.dist-info}/RECORD +6 -6
- {ursa_ai-0.2.10.dist-info → ursa_ai-0.2.11.dist-info}/WHEEL +0 -0
- {ursa_ai-0.2.10.dist-info → ursa_ai-0.2.11.dist-info}/licenses/LICENSE +0 -0
- {ursa_ai-0.2.10.dist-info → ursa_ai-0.2.11.dist-info}/top_level.txt +0 -0
ursa/util/memory_logger.py
CHANGED
|
@@ -26,20 +26,30 @@ class AgentMemory:
|
|
|
26
26
|
* Requires `langchain-chroma`, and `chromadb`.
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
|
+
@classmethod
|
|
30
|
+
def get_db_path(cls, path: Optional[str | Path]) -> Path:
|
|
31
|
+
match path:
|
|
32
|
+
case None:
|
|
33
|
+
return Path.home() / ".cache" / "ursa" / "rag" / "db"
|
|
34
|
+
case str():
|
|
35
|
+
return Path(str)
|
|
36
|
+
case Path():
|
|
37
|
+
return path
|
|
38
|
+
case _:
|
|
39
|
+
raise TypeError(
|
|
40
|
+
f"Type of path is `{type(path)}` "
|
|
41
|
+
"but `Optional[str | Path]` was expected."
|
|
42
|
+
)
|
|
43
|
+
|
|
29
44
|
def __init__(
|
|
30
45
|
self,
|
|
31
46
|
embedding_model,
|
|
32
47
|
path: Optional[str | Path] = None,
|
|
33
48
|
collection_name: str = "agent_memory",
|
|
34
49
|
) -> None:
|
|
35
|
-
self.path = (
|
|
36
|
-
Path(path)
|
|
37
|
-
if path
|
|
38
|
-
else Path(__file__).resolve().parent / "agent_memory_db"
|
|
39
|
-
)
|
|
50
|
+
self.path = self.get_db_path(path)
|
|
40
51
|
self.collection_name = collection_name
|
|
41
52
|
self.path.mkdir(parents=True, exist_ok=True)
|
|
42
|
-
|
|
43
53
|
self.embeddings = embedding_model
|
|
44
54
|
|
|
45
55
|
# If a DB already exists, load it; otherwise defer creation until `build_index`.
|
|
@@ -165,8 +175,7 @@ def delete_database(path: Optional[str | Path] = None):
|
|
|
165
175
|
Where the on-disk Chroma DB is for deleting. If *None*, a folder called
|
|
166
176
|
``agent_memory_db`` is created in the package’s base directory.
|
|
167
177
|
"""
|
|
168
|
-
|
|
169
|
-
db_path = Path(path) if path else Path("~/.cache/ursa/rag/db/")
|
|
178
|
+
db_path = AgentMemory.get_db_path(path)
|
|
170
179
|
if os.path.exists(db_path):
|
|
171
180
|
shutil.rmtree(db_path)
|
|
172
181
|
print(f"Database: {db_path} has been deleted.")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ursa-ai
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.11
|
|
4
4
|
Summary: Agents for science at LANL
|
|
5
5
|
Author-email: Mike Grosskopf <mikegros@lanl.gov>, Nathan Debardeleben <ndebard@lanl.gov>, Rahul Somasundaram <rsomasundaram@lanl.gov>, Isaac Michaud <imichaud@lanl.gov>, Avanish Mishra <avanish@lanl.gov>, Arthur Lui <alui@lanl.gov>, Russell Bent <rbent@lanl.gov>, Earl Lawrence <earl@lanl.gov>
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -17,10 +17,10 @@ ursa/prompt_library/websearch_prompts.py,sha256=n4DJaYn_lIYAVtdy00CCJjT-dLWhn2JN
|
|
|
17
17
|
ursa/tools/run_command.py,sha256=sQRuHtRyJYWEyL9dpW_Ukc-xQ5vmKKJK1i_6z3uKEfA,690
|
|
18
18
|
ursa/tools/write_code.py,sha256=DtCsUMZegYm0mk-HMPG5Zo3Ba1gbGfnXHsv1NZTdDs8,1220
|
|
19
19
|
ursa/util/diff_renderer.py,sha256=1L1q2qWWb8gLhR532-LgJn2TrqXDx0gUpPVOWD_sqeU,4086
|
|
20
|
-
ursa/util/memory_logger.py,sha256
|
|
20
|
+
ursa/util/memory_logger.py,sha256=9tNPF3Fgth4ImpNbs7Qg5Ci6Hb1ziMWsDTsqjkDi1iY,6096
|
|
21
21
|
ursa/util/parse.py,sha256=M0cjyQWmjatxX4WbVmDRUiirTLyW-t_Aemlrlrsc5nA,2811
|
|
22
|
-
ursa_ai-0.2.
|
|
23
|
-
ursa_ai-0.2.
|
|
24
|
-
ursa_ai-0.2.
|
|
25
|
-
ursa_ai-0.2.
|
|
26
|
-
ursa_ai-0.2.
|
|
22
|
+
ursa_ai-0.2.11.dist-info/licenses/LICENSE,sha256=4Vr6_u2zTHIUvYjoOBg9ztDbfpV3hyCFv3mTCS87gYU,1482
|
|
23
|
+
ursa_ai-0.2.11.dist-info/METADATA,sha256=apeOKu1ZbVz8Fbi4p41DsdGLkasx8yZ0uuE2BjUAmek,6849
|
|
24
|
+
ursa_ai-0.2.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
25
|
+
ursa_ai-0.2.11.dist-info/top_level.txt,sha256=OjA1gRYSUAeiXGnpqPC8iOOGfcjFO1IlP848qMnYSdY,5
|
|
26
|
+
ursa_ai-0.2.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|