antonlytics 2.1.0__tar.gz → 2.2.0__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.
Files changed (22) hide show
  1. {antonlytics-2.1.0 → antonlytics-2.2.0}/PKG-INFO +1 -1
  2. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics/__init__.py +1 -1
  3. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics/agent.py +73 -25
  4. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics.egg-info/PKG-INFO +1 -1
  5. {antonlytics-2.1.0 → antonlytics-2.2.0}/pyproject.toml +1 -1
  6. {antonlytics-2.1.0 → antonlytics-2.2.0}/setup.py +1 -1
  7. {antonlytics-2.1.0 → antonlytics-2.2.0}/.gitignore +0 -0
  8. {antonlytics-2.1.0 → antonlytics-2.2.0}/.pyre/pyre.stderr +0 -0
  9. {antonlytics-2.1.0 → antonlytics-2.2.0}/LICENSE +0 -0
  10. {antonlytics-2.1.0 → antonlytics-2.2.0}/MANIFEST.in +0 -0
  11. {antonlytics-2.1.0 → antonlytics-2.2.0}/Makefile +0 -0
  12. {antonlytics-2.1.0 → antonlytics-2.2.0}/README.md +0 -0
  13. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics/exceptions.py +0 -0
  14. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics/http_client.py +0 -0
  15. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics/integrations/__init__.py +0 -0
  16. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics/integrations/langchain.py +0 -0
  17. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics.egg-info/SOURCES.txt +0 -0
  18. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics.egg-info/dependency_links.txt +0 -0
  19. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics.egg-info/requires.txt +0 -0
  20. {antonlytics-2.1.0 → antonlytics-2.2.0}/antonlytics.egg-info/top_level.txt +0 -0
  21. {antonlytics-2.1.0 → antonlytics-2.2.0}/examples/langchain_quickstart.py +0 -0
  22. {antonlytics-2.1.0 → antonlytics-2.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: antonlytics
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Memory for AI Agents - Simple natural language SDK
5
5
  Home-page: https://github.com/Voidback-Inc/antonlytics-python-sdk
6
6
  Author: Voidback
@@ -7,5 +7,5 @@ Simple SDK for giving your AI agent persistent memory.
7
7
  from .agent import Agent
8
8
  from .exceptions import AntonlyticsError, APIError, AuthenticationError
9
9
 
10
- __version__ = "2.1.0"
10
+ __version__ = "2.2.0"
11
11
  __all__ = ["Agent", "AntonlyticsError", "APIError", "AuthenticationError"]
@@ -2,7 +2,7 @@
2
2
  Agent class for interacting with Antonlytics API.
3
3
  """
4
4
 
5
- from typing import Dict, Any, Optional, List
5
+ from typing import Dict, Any, Optional, List, Iterator
6
6
  from .http_client import HTTPClient
7
7
  from .exceptions import AntonlyticsError
8
8
 
@@ -121,41 +121,89 @@ class Agent:
121
121
 
122
122
  return self.client.post('/api/v1/memory/chat/', payload)
123
123
 
124
- def get_memory(self, query: Optional[str] = None) -> Dict[str, Any]:
124
+ def get_memory(
125
+ self,
126
+ query: Optional[str] = None,
127
+ *,
128
+ max_entities: int = 10_000,
129
+ page_size: int = 500,
130
+ ) -> Dict[str, Any]:
125
131
  """
126
132
  Get memory context for your own agent/model.
127
- Returns structured knowledge graph data.
128
-
133
+
134
+ Two modes:
135
+ - ``query`` provided: semantic top-K retrieval (single shot, server-ranked).
136
+ Returns the most relevant entities and their relationships.
137
+ - ``query=None``: enumerates the full project graph via cursor pagination,
138
+ auto-iterating pages internally. Stops at ``max_entities`` for safety.
139
+
129
140
  Args:
130
- query: Optional natural language query to filter context
131
-
141
+ query: Optional natural language query for ranked retrieval.
142
+ max_entities: Safety ceiling for full-graph mode (default 10000).
143
+ page_size: Pagination page size for full-graph mode (1-1000, default 500).
144
+
132
145
  Returns:
133
- Dict with entities and relationships
134
-
146
+ Dict with entities and relationships.
147
+
135
148
  Example:
136
- >>> # Get all memory
137
- >>> memory = agent.get_memory()
138
- >>>
139
- >>> # Use with your own model
140
- >>> your_model.chat(
141
- ... system="You are a sales assistant",
142
- ... context=memory,
143
- ... message="Who to follow up?"
144
- ... )
149
+ >>> # Top-K retrieval for prompt context
150
+ >>> memory = agent.get_memory(query="What did Sarah say?")
151
+ >>>
152
+ >>> # Full project dump (auto-paginated)
153
+ >>> all_memory = agent.get_memory()
154
+ >>>
155
+ >>> # For very large projects, stream pages:
156
+ >>> for page in agent.iter_memory(page_size=500):
157
+ ... process(page)
145
158
  """
146
159
  if query:
147
160
  response = self.client.post('/api/v1/memory/query/', {
148
161
  'question': query,
149
- 'project_id': self.project_id
150
- })
151
- return response.get('graph_context', {})
152
- else:
153
- # Get all memory
154
- response = self.client.post('/api/v1/memory/query/', {
155
- 'question': 'What do you know?',
156
- 'project_id': self.project_id
162
+ 'project_id': self.project_id,
157
163
  })
158
164
  return response.get('graph_context', {})
165
+
166
+ # Full-graph mode: auto-paginate via /memory/list/.
167
+ entities: List[Dict[str, Any]] = []
168
+ relationships: List[Dict[str, Any]] = []
169
+ for page in self.iter_memory(page_size=page_size):
170
+ entities.extend(page.get('entities', []))
171
+ relationships.extend(page.get('relationships', []))
172
+ if len(entities) >= max_entities:
173
+ entities = entities[:max_entities]
174
+ break
175
+ return {'entities': entities, 'relationships': relationships}
176
+
177
+ def iter_memory(self, page_size: int = 500) -> Iterator[Dict[str, Any]]:
178
+ """
179
+ Stream the full project graph one page at a time.
180
+
181
+ Yields a dict ``{entities, relationships, next_cursor, has_more}`` per page.
182
+ Iteration stops automatically when the server reports no more pages.
183
+
184
+ Args:
185
+ page_size: Rows per page (1-1000, default 500).
186
+
187
+ Example:
188
+ >>> for page in agent.iter_memory(page_size=200):
189
+ ... for entity in page["entities"]:
190
+ ... print(entity["name"])
191
+ """
192
+ cursor: Optional[str] = None
193
+ while True:
194
+ payload: Dict[str, Any] = {
195
+ 'project_id': self.project_id,
196
+ 'limit': page_size,
197
+ }
198
+ if cursor:
199
+ payload['cursor'] = cursor
200
+ page = self.client.post('/api/v1/memory/list/', payload)
201
+ yield page
202
+ if not page.get('has_more'):
203
+ break
204
+ cursor = page.get('next_cursor')
205
+ if not cursor:
206
+ break
159
207
 
160
208
  def set_system_prompt(self, prompt: str) -> Dict[str, Any]:
161
209
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: antonlytics
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Memory for AI Agents - Simple natural language SDK
5
5
  Home-page: https://github.com/Voidback-Inc/antonlytics-python-sdk
6
6
  Author: Voidback
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "antonlytics"
7
- version = "2.1.0"
7
+ version = "2.2.0"
8
8
  description = "Memory for AI Agents - Simple natural language SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -9,7 +9,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
9
9
 
10
10
  setup(
11
11
  name="antonlytics",
12
- version="2.1.0",
12
+ version="2.2.0",
13
13
  author="Voidback",
14
14
  author_email="hello@voidback.com",
15
15
  description="Memory for AI Agents - Simple natural language SDK",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes