amsdal_ml 0.1.3__py3-none-any.whl → 0.2.0__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.
Files changed (63) hide show
  1. amsdal_ml/Third-Party Materials - AMSDAL Dependencies - License Notices.md +617 -0
  2. amsdal_ml/__about__.py +1 -1
  3. amsdal_ml/agents/__init__.py +13 -0
  4. amsdal_ml/agents/agent.py +5 -7
  5. amsdal_ml/agents/default_qa_agent.py +108 -143
  6. amsdal_ml/agents/functional_calling_agent.py +233 -0
  7. amsdal_ml/agents/mcp_client_tool.py +46 -0
  8. amsdal_ml/agents/python_tool.py +86 -0
  9. amsdal_ml/agents/retriever_tool.py +17 -8
  10. amsdal_ml/agents/tool_adapters.py +98 -0
  11. amsdal_ml/fileio/base_loader.py +7 -5
  12. amsdal_ml/fileio/openai_loader.py +16 -17
  13. amsdal_ml/mcp_client/base.py +2 -0
  14. amsdal_ml/mcp_client/http_client.py +7 -1
  15. amsdal_ml/mcp_client/stdio_client.py +21 -18
  16. amsdal_ml/mcp_server/server_retriever_stdio.py +8 -11
  17. amsdal_ml/ml_ingesting/__init__.py +29 -0
  18. amsdal_ml/ml_ingesting/default_ingesting.py +49 -51
  19. amsdal_ml/ml_ingesting/embedders/__init__.py +4 -0
  20. amsdal_ml/ml_ingesting/embedders/embedder.py +12 -0
  21. amsdal_ml/ml_ingesting/embedders/openai_embedder.py +30 -0
  22. amsdal_ml/ml_ingesting/embedding_data.py +3 -0
  23. amsdal_ml/ml_ingesting/loaders/__init__.py +6 -0
  24. amsdal_ml/ml_ingesting/loaders/folder_loader.py +52 -0
  25. amsdal_ml/ml_ingesting/loaders/loader.py +28 -0
  26. amsdal_ml/ml_ingesting/loaders/pdf_loader.py +136 -0
  27. amsdal_ml/ml_ingesting/loaders/text_loader.py +44 -0
  28. amsdal_ml/ml_ingesting/model_ingester.py +278 -0
  29. amsdal_ml/ml_ingesting/pipeline.py +131 -0
  30. amsdal_ml/ml_ingesting/pipeline_interface.py +31 -0
  31. amsdal_ml/ml_ingesting/processors/__init__.py +4 -0
  32. amsdal_ml/ml_ingesting/processors/cleaner.py +14 -0
  33. amsdal_ml/ml_ingesting/processors/text_cleaner.py +42 -0
  34. amsdal_ml/ml_ingesting/splitters/__init__.py +4 -0
  35. amsdal_ml/ml_ingesting/splitters/splitter.py +15 -0
  36. amsdal_ml/ml_ingesting/splitters/token_splitter.py +85 -0
  37. amsdal_ml/ml_ingesting/stores/__init__.py +4 -0
  38. amsdal_ml/ml_ingesting/stores/embedding_data.py +63 -0
  39. amsdal_ml/ml_ingesting/stores/store.py +22 -0
  40. amsdal_ml/ml_ingesting/types.py +40 -0
  41. amsdal_ml/ml_models/models.py +96 -4
  42. amsdal_ml/ml_models/openai_model.py +430 -122
  43. amsdal_ml/ml_models/utils.py +7 -0
  44. amsdal_ml/ml_retrievers/__init__.py +17 -0
  45. amsdal_ml/ml_retrievers/adapters.py +93 -0
  46. amsdal_ml/ml_retrievers/default_retriever.py +11 -1
  47. amsdal_ml/ml_retrievers/openai_retriever.py +27 -7
  48. amsdal_ml/ml_retrievers/query_retriever.py +487 -0
  49. amsdal_ml/ml_retrievers/retriever.py +12 -0
  50. amsdal_ml/models/embedding_model.py +7 -7
  51. amsdal_ml/prompts/__init__.py +77 -0
  52. amsdal_ml/prompts/database_query_agent.prompt +14 -0
  53. amsdal_ml/prompts/functional_calling_agent_base.prompt +9 -0
  54. amsdal_ml/prompts/nl_query_filter.prompt +318 -0
  55. amsdal_ml/{agents/promts → prompts}/react_chat.prompt +17 -8
  56. amsdal_ml/utils/__init__.py +5 -0
  57. amsdal_ml/utils/query_utils.py +189 -0
  58. amsdal_ml-0.2.0.dist-info/METADATA +293 -0
  59. amsdal_ml-0.2.0.dist-info/RECORD +72 -0
  60. {amsdal_ml-0.1.3.dist-info → amsdal_ml-0.2.0.dist-info}/WHEEL +1 -1
  61. amsdal_ml/agents/promts/__init__.py +0 -58
  62. amsdal_ml-0.1.3.dist-info/METADATA +0 -69
  63. amsdal_ml-0.1.3.dist-info/RECORD +0 -39
@@ -0,0 +1,293 @@
1
+ Metadata-Version: 2.4
2
+ Name: amsdal_ml
3
+ Version: 0.2.0
4
+ Summary: amsdal_ml plugin for AMSDAL Framework
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: aiohttp==3.12.15
7
+ Requires-Dist: amsdal-cli>=0.5.7
8
+ Requires-Dist: amsdal-data>=0.5.9
9
+ Requires-Dist: amsdal-models>=0.5.9
10
+ Requires-Dist: amsdal-utils>=0.5.4
11
+ Requires-Dist: amsdal>=0.5.6
12
+ Requires-Dist: mcp>=0.1
13
+ Requires-Dist: openai==1.100.2
14
+ Requires-Dist: pydantic-settings==2.10.1
15
+ Requires-Dist: pydantic==2.11.7
16
+ Requires-Dist: pymupdf>=1.24.10
17
+ Description-Content-Type: text/markdown
18
+
19
+ # AMSDAL ML
20
+
21
+ [![CI](https://github.com/amsdal/amsdal_ml/actions/workflows/ci.yml/badge.svg)](https://github.com/amsdal/amsdal_ml/actions/workflows/ci.yml)
22
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
23
+
24
+ Machine learning plugin for the AMSDAL Framework, providing embeddings, vector search, semantic retrieval, and AI agents with support for OpenAI models.
25
+
26
+ ## Features
27
+
28
+ - **Vector Embeddings**: Generate and store embeddings for any AMSDAL model with automatic chunking
29
+ - **Semantic Search**: Query your data using natural language with tag-based filtering
30
+ - **AI Agents**: Build Q&A systems with streaming support and citation tracking
31
+ - **Async-First**: Optimized for high-performance async operations
32
+ - **MCP Integration**: Expose and consume tools via Model Context Protocol (stdio/HTTP)
33
+ - **File Attachments**: Process and embed documents with built-in loaders
34
+ - **Extensible**: Abstract base classes for custom models, retrievers, and ingesters
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pip install amsdal-ml
40
+ ```
41
+
42
+ ### Requirements
43
+
44
+ - Python 3.11 or higher
45
+ - AMSDAL Framework 0.5.6+
46
+ - OpenAI API key (for default implementations)
47
+
48
+ ## Quick Start
49
+
50
+ ### 1. Configuration
51
+
52
+ Create a `.env` file in your project root:
53
+
54
+ ```env
55
+ OPENAI_API_KEY=sk-your-api-key-here
56
+ async_mode=true
57
+ ml_model_class=amsdal_ml.ml_models.openai_model.OpenAIModel
58
+ ml_retriever_class=amsdal_ml.ml_retrievers.openai_retriever.OpenAIRetriever
59
+ ml_ingesting_class=amsdal_ml.ml_ingesting.openai_ingesting.OpenAIIngesting
60
+ ```
61
+
62
+ Create a `config.yml` for AMSDAL connections:
63
+
64
+ ```yaml
65
+ application_name: my-ml-app
66
+ async_mode: true
67
+ connections:
68
+ - name: sqlite_state
69
+ backend: sqlite-state-async
70
+ credentials:
71
+ - db_path: ./warehouse/state.sqlite3
72
+ - check_same_thread: false
73
+ - name: lock
74
+ backend: amsdal_data.lock.implementations.thread_lock.ThreadLock
75
+ resources_config:
76
+ repository:
77
+ default: sqlite_state
78
+ lock: lock
79
+ ```
80
+
81
+ ### 2. Generate Embeddings
82
+
83
+ ```python
84
+ from amsdal_ml.ml_ingesting.openai_ingesting import OpenAIIngesting
85
+ from amsdal_ml.ml_config import ml_config
86
+
87
+ # Initialize ingesting
88
+ ingester = OpenAIIngesting(
89
+ model=MyModel,
90
+ embedding_field='embedding',
91
+ )
92
+
93
+ # Generate embeddings for an instance
94
+ instance = MyModel(content='Your text here')
95
+ embeddings = await ingester.agenerate_embeddings(instance)
96
+ await ingester.asave(embeddings, instance)
97
+ ```
98
+
99
+ ### 3. Semantic Search
100
+
101
+ ```python
102
+ from amsdal_ml.ml_retrievers.openai_retriever import OpenAIRetriever
103
+
104
+ retriever = OpenAIRetriever()
105
+
106
+ # Search for relevant content
107
+ results = await retriever.asimilarity_search(
108
+ query='What is machine learning?',
109
+ k=5,
110
+ include_tags=['documentation']
111
+ )
112
+
113
+ for chunk in results:
114
+ print(f'{chunk.object_class}:{chunk.object_id} - {chunk.raw_text}')
115
+ ```
116
+
117
+ ### 4. Build an AI Agent
118
+
119
+ ```python
120
+ from amsdal_ml.agents.default_qa_agent import DefaultQAAgent
121
+
122
+ agent = DefaultQAAgent()
123
+
124
+ # Ask questions
125
+ output = await agent.arun('Explain vector embeddings')
126
+ print(output.answer)
127
+ print(f'Used tools: {output.used_tools}')
128
+
129
+ # Stream responses
130
+ async for chunk in agent.astream('What is semantic search?'):
131
+ print(chunk, end='', flush=True)
132
+ ```
133
+
134
+ ### 5. Functional Calling Agent with Python Tools
135
+
136
+ ```python
137
+ from amsdal_ml.agents.functional_calling_agent import FunctionalCallingAgent
138
+ from amsdal_ml.agents.python_tool import PythonTool
139
+ from amsdal_ml.ml_models.openai_model import OpenAIModel
140
+
141
+ llm = OpenAIModel()
142
+ agent = FunctionalCallingAgent(model=llm, tools=[search_tool, render_tool])
143
+ result = await agent.arun(user_query="Find products with price > 100", history=[])
144
+ ```
145
+
146
+ ### 6. Natural Language Query Retriever
147
+
148
+ ```python
149
+ from amsdal_ml.ml_retrievers.query_retriever import NLQueryRetriever
150
+
151
+ retriever = NLQueryRetriever(llm=llm, queryset=Product.objects.all())
152
+ documents = await retriever.invoke("Show me red products", limit=10)
153
+ ```
154
+
155
+ ### 7. Document Ingestion Pipeline
156
+
157
+ ```python
158
+ from amsdal_ml.ml_ingesting import ModelIngester
159
+ from amsdal_ml.ml_ingesting.pipeline import DefaultIngestionPipeline
160
+ from amsdal_ml.ml_ingesting.loaders.pdf_loader import PdfLoader
161
+ from amsdal_ml.ml_ingesting.processors.text_cleaner import TextCleaner
162
+ from amsdal_ml.ml_ingesting.splitters.token_splitter import TokenSplitter
163
+ from amsdal_ml.ml_ingesting.embedders.openai_embedder import OpenAIEmbedder
164
+ from amsdal_ml.ml_ingesting.stores.embedding_data import EmbeddingDataStore
165
+
166
+ pipeline = DefaultIngestionPipeline(
167
+ loader=PdfLoader(), # Uses pymupdf for PDF processing
168
+ cleaner=TextCleaner(),
169
+ splitter=TokenSplitter(max_tokens=800, overlap_tokens=80),
170
+ embedder=OpenAIEmbedder(),
171
+ store=EmbeddingDataStore(),
172
+ )
173
+
174
+ ingester = ModelIngester(
175
+ pipeline=pipeline,
176
+ base_tags=["document"],
177
+ base_metadata={"source": "pdf"},
178
+ )
179
+ ```
180
+
181
+ ## Architecture
182
+
183
+ ### Core Components
184
+
185
+ - **`MLModel`**: Abstract interface for LLM inference (invoke, stream, with attachments)
186
+ - **`MLIngesting`**: Generate text and embeddings from data objects with chunking
187
+ - **`MLRetriever`**: Semantic similarity search with tag-based filtering
188
+ - **`Agent`**: Q&A and task-oriented agents with streaming and citations
189
+ - **`EmbeddingModel`**: Database model storing 1536-dimensional vectors linked to source objects
190
+ - **`PythonTool`**: Tool for executing Python functions within agents
191
+ - **`FunctionalCallingAgent`**: Agent specialized in functional calling with configurable tools
192
+ - **`NLQueryRetriever`**: Retriever for natural language queries on AMSDAL querysets
193
+ - **`DefaultIngestionPipeline`**: Pipeline for document ingestion including loader, cleaner, splitter, embedder, and store
194
+ - **`ModelIngester`**: High-level ingester for processing models with customizable pipelines and metadata
195
+ - **`PdfLoader`**: Document loader using pymupdf for PDF processing
196
+ - **`TextCleaner`**: Processor for cleaning and normalizing text
197
+ - **`TokenSplitter`**: Splitter for dividing text into chunks based on token count
198
+ - **`OpenAIEmbedder`**: Embedder for generating embeddings via OpenAI API
199
+ - **`EmbeddingDataStore`**: Store for saving embedding data linked to source objects
200
+ - **MCP Server/Client**: Expose retrievers as tools or consume external MCP services
201
+
202
+ ### Configuration
203
+
204
+ All settings are managed via `MLConfig` in `.env`:
205
+
206
+ ```env
207
+ # Model Configuration
208
+ llm_model_name=gpt-4o
209
+ llm_temperature=0.0
210
+ embed_model_name=text-embedding-3-small
211
+
212
+ # Chunking Parameters
213
+ embed_max_depth=2
214
+ embed_max_chunks=10
215
+ embed_max_tokens_per_chunk=800
216
+
217
+ # Retrieval Settings
218
+ retriever_default_k=8
219
+ ```
220
+
221
+ ## Development
222
+
223
+ ### Setup
224
+
225
+ ```bash
226
+ # Install dependencies
227
+ pip install --upgrade uv hatch==1.14.2
228
+ hatch env create
229
+ hatch run sync
230
+ ```
231
+
232
+ ### Testing
233
+
234
+ ```bash
235
+ # Run all tests with coverage
236
+ hatch run cov
237
+
238
+ # Run specific tests
239
+ hatch run test tests/test_openai_model.py
240
+
241
+ # Watch mode
242
+ pytest tests/ -v
243
+ ```
244
+
245
+ ### Code Quality
246
+
247
+ ```bash
248
+ # Run all checks (style + typing)
249
+ hatch run all
250
+
251
+ # Format code
252
+ hatch run fmt
253
+
254
+ # Type checking
255
+ hatch run typing
256
+ ```
257
+
258
+ ### AMSDAL CLI
259
+
260
+ ```bash
261
+ # Generate a new model
262
+ amsdal generate model MyModel --format py
263
+
264
+ # Generate property
265
+ amsdal generate property --model MyModel embedding_field
266
+
267
+ # Generate transaction
268
+ amsdal generate transaction ProcessEmbeddings
269
+
270
+ # Generate hook
271
+ amsdal generate hook --model MyModel on_create
272
+ ```
273
+
274
+ ## MCP Server
275
+
276
+ Run the retriever as an MCP server for integration with Claude Desktop or other MCP clients:
277
+
278
+ ```bash
279
+ python -m amsdal_ml.mcp_server.server_retriever_stdio \
280
+ --amsdal-config "$(echo '{"async_mode": true, ...}' | base64)"
281
+ ```
282
+
283
+ The server exposes a `search` tool for semantic search in your knowledge base.
284
+
285
+ ## License
286
+
287
+ See `amsdal_ml/Third-Party Materials - AMSDAL Dependencies - License Notices.md` for dependency licenses.
288
+
289
+ ## Links
290
+
291
+ - [AMSDAL Framework](https://github.com/amsdal/amsdal)
292
+ - [Documentation](https://docs.amsdal.com)
293
+ - [Issue Tracker](https://github.com/amsdal/amsdal_ml/issues)
@@ -0,0 +1,72 @@
1
+ amsdal_ml/Third-Party Materials - AMSDAL Dependencies - License Notices.md,sha256=ML7PqsHrTMNNZn8E_rA-LzDCAafMSxMcrmSg8YOi-wo,113896
2
+ amsdal_ml/__about__.py,sha256=FVHPBGkfhbQDi_z3v0PiKJrXXqXOx0vGW_1VaqNJi7U,22
3
+ amsdal_ml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ amsdal_ml/app.py,sha256=K_lUz37_FUQmPwzDakDhVXA_D2SL9z1JtcuHfuBvlKE,184
5
+ amsdal_ml/ml_config.py,sha256=UONMVG2RbKVbaYF-GdlhRQbm8flp52GxBzfqdzuLZ5w,1788
6
+ amsdal_ml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ amsdal_ml/agents/__init__.py,sha256=uKqtPo0Q0qeaDdz0J39XbqKDTCpT4nvm6uBWj7odxEE,393
8
+ amsdal_ml/agents/agent.py,sha256=Yz0i5xvblv4yfXRChRMjkpTxBNQIefEw3OVsJdozpvM,1498
9
+ amsdal_ml/agents/default_qa_agent.py,sha256=1b4GjE2-LFGow2ab4cb-K4kutv63-0Wf7svvJRWfk5I,13354
10
+ amsdal_ml/agents/functional_calling_agent.py,sha256=4qd_-Q457XhJq0GHIXWiQwiw4WZE4LEw1o88VQ4ppsk,9166
11
+ amsdal_ml/agents/mcp_client_tool.py,sha256=Q_AJaXqZfG9Sqs8oHMhGJV-j_-cmp-qPNuqhbhExVsg,1246
12
+ amsdal_ml/agents/python_tool.py,sha256=qrWOfc9pz1mAU506A-0bgwhkahaNT_t_E7RmSo2slFg,2616
13
+ amsdal_ml/agents/retriever_tool.py,sha256=ckSVPahfYQ12E3F5ouPV085LeQinlyxEQrBpRSfJzbU,2220
14
+ amsdal_ml/agents/tool_adapters.py,sha256=GJoAx6rRnf-db_5ExPi5KpbiROF0TetcOAh8-sT1Nf0,3244
15
+ amsdal_ml/fileio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ amsdal_ml/fileio/base_loader.py,sha256=Ca0_zrRqj9DYSidcbcJAhkZLT_TalYnYhGRoR_RfetA,1868
17
+ amsdal_ml/fileio/openai_loader.py,sha256=Bfe2pfkodggsslU5csg2AKRhwcoxsfpPIhFWSvMKvKY,2560
18
+ amsdal_ml/mcp_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ amsdal_ml/mcp_client/base.py,sha256=PifmlAxxlpFkFLLN8VHKV3XbeSXKA4jcE_u4gPacm9U,497
20
+ amsdal_ml/mcp_client/http_client.py,sha256=VFTNZ8b9sboa67_4db0K1R6CtwM6KdVjmH1t_l0FZMk,1765
21
+ amsdal_ml/mcp_client/stdio_client.py,sha256=HTutdoLSIPu18_le_B2zcZ4qep99y6DHg7LNNA7To_s,5896
22
+ amsdal_ml/mcp_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ amsdal_ml/mcp_server/server_retriever_stdio.py,sha256=7PcfUShO3STNfKijs0s_aeCn7BExawaBe5wV_EEfW7Q,1741
24
+ amsdal_ml/migrations/0000_initial.py,sha256=UeEtqHrCgmTQyGnyV2jC7yt9Ce7Xm0-MyhOQU3rRrs8,1633
25
+ amsdal_ml/ml_ingesting/__init__.py,sha256=r1XwbdBgOvmn2QujJJaHgtKBJqqgUrb3Jvd2RFhYcJU,1069
26
+ amsdal_ml/ml_ingesting/default_ingesting.py,sha256=PLxNZv-cEta4GWby6U2_kx8LS1D_gzIeerDVTtIol8g,12845
27
+ amsdal_ml/ml_ingesting/embedding_data.py,sha256=6Umr2guR1fXhhwFUfKpOnzH4ex3bbaKXqg1CMlwMZeM,466
28
+ amsdal_ml/ml_ingesting/ingesting.py,sha256=h-GdNCtutO8C75jbLko40CMjHym9Xk_nlMdNYLfBs58,1458
29
+ amsdal_ml/ml_ingesting/model_ingester.py,sha256=XifIX9-3dWkx9i7pG2eoq9rjRKX0jUM9ni57ICgEOcs,10752
30
+ amsdal_ml/ml_ingesting/openai_ingesting.py,sha256=_2dU2id2a3xR_y0GvZc5LUDw3_wI-wbhEFogEOKF-H0,1421
31
+ amsdal_ml/ml_ingesting/pipeline.py,sha256=lsmgRs0bUiuDh3YLk_G4TyCZvYFOTxha6u00puaCwAQ,4968
32
+ amsdal_ml/ml_ingesting/pipeline_interface.py,sha256=6dtVEEvfeQ4-wdhFr7RxBgzHm1I-dmxbdr6aw0t11LQ,731
33
+ amsdal_ml/ml_ingesting/types.py,sha256=iJW8tdQ37LiIFKXhE4fvaDPXkbSHL2GV43c3kwNGakc,1602
34
+ amsdal_ml/ml_ingesting/embedders/__init__.py,sha256=flx9X7KbLQhvoa8qhLtQqr6wt_BQ1p4OpqAd0Olmkg8,181
35
+ amsdal_ml/ml_ingesting/embedders/embedder.py,sha256=I8J4R0uBcP8x8u04ELqWfV4r1z93FXoXJth1nP9tnwo,260
36
+ amsdal_ml/ml_ingesting/embedders/openai_embedder.py,sha256=HKZ7N6PsMGYDEh0FJYpNgpmqlrjdnudhHyKPbSMRHs0,1133
37
+ amsdal_ml/ml_ingesting/loaders/__init__.py,sha256=B7Gcc_URThz4FjmOc0IUEi8q4la8p1AreA5mH2Qsw9k,334
38
+ amsdal_ml/ml_ingesting/loaders/folder_loader.py,sha256=via8ND-rL4SmGmaeQUn4z5ctRXbfwvyPtcHh3tQzWiU,2002
39
+ amsdal_ml/ml_ingesting/loaders/loader.py,sha256=ETSdwQHtnhpXXEIawOvXahA9pwVTyxzFAJgudqRev1s,610
40
+ amsdal_ml/ml_ingesting/loaders/pdf_loader.py,sha256=Kq1nRJHjt9PiQadF92kyC7w2WeFfFMtZI89Co-5WR9Y,4201
41
+ amsdal_ml/ml_ingesting/loaders/text_loader.py,sha256=dOWk-sPquoh1TTRZR_jKw8X7BGKyeTUoih0ImUBRBcs,1369
42
+ amsdal_ml/ml_ingesting/processors/__init__.py,sha256=cDWOIqjLwgIRpysJLishZl68jpAwDe4tPZyhLaPadiQ,171
43
+ amsdal_ml/ml_ingesting/processors/cleaner.py,sha256=1hWxYTFpWckzqISewUoKTnhlhPVvPyGL1H1o7OGxX-Y,342
44
+ amsdal_ml/ml_ingesting/processors/text_cleaner.py,sha256=sVAlTlpH0WlklXbHx53GdGA8gb1U4WAMtyoWuU0C-J0,1372
45
+ amsdal_ml/ml_ingesting/splitters/__init__.py,sha256=3bRqxmAp60fhp7VLrEIpwToY7kG7yb2EPDUbvEDBCcg,178
46
+ amsdal_ml/ml_ingesting/splitters/splitter.py,sha256=NewyPeWdMxIdZkx8QyP3B2v9wtEsR0Ra1hrd6mOE48U,396
47
+ amsdal_ml/ml_ingesting/splitters/token_splitter.py,sha256=YY8DaSK8156pKpBjt3g2_0TPRISx_dM-Sx5LvTbwl0w,2762
48
+ amsdal_ml/ml_ingesting/stores/__init__.py,sha256=NnwCVjmEdM5_fLKmCZEZwS2NEJgf_YT6VBcg4wUFZM0,191
49
+ amsdal_ml/ml_ingesting/stores/embedding_data.py,sha256=zbYF8l6L4IgNpuLmtNYqxKzvd5Jr3sdcVFwe4a7QeUs,2366
50
+ amsdal_ml/ml_ingesting/stores/store.py,sha256=WTX22e_7qCwCPNFmJYNIMwr8Ppkw7NlIri8SEweVoAw,617
51
+ amsdal_ml/ml_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
+ amsdal_ml/ml_models/models.py,sha256=w_sFzDqV4L1OUaGzmODU1Y0nCXo19SBeqjvD-W0ROfU,5501
53
+ amsdal_ml/ml_models/openai_model.py,sha256=00-qfaDFA76dAzSAj_P36-pvCKXQepXx6lNbCKnpH0I,24323
54
+ amsdal_ml/ml_models/utils.py,sha256=fOwRC4gfmmtGIFsI0aXjvSPxEApFsxiQ3Hicx71QykU,146
55
+ amsdal_ml/ml_retrievers/__init__.py,sha256=duWEkdfwbJN05yiJOfzKOK_xERLSxXGPUrCexZ6Ubhw,619
56
+ amsdal_ml/ml_retrievers/adapters.py,sha256=-luzriafS_AZAp8yfINfVX6jTXuGlM9slF-f6UztveY,2983
57
+ amsdal_ml/ml_retrievers/default_retriever.py,sha256=SNeBkfdgwsNxrgAl2lyHhDw5cIJD4hYwkH7_tfWkRUU,3541
58
+ amsdal_ml/ml_retrievers/openai_retriever.py,sha256=uSYrKk_aJwUAyQdolg1ZGaWbB4w63TfLm_BQz9m4qtI,1970
59
+ amsdal_ml/ml_retrievers/query_retriever.py,sha256=g0DNH4QSYPvbyi7R8rrMAFmpjmMm2QmipM4AhVGUpoY,17209
60
+ amsdal_ml/ml_retrievers/retriever.py,sha256=Nh6kltqO1XirDJtUyi8Bl7Dm9d2lDEwh-4TwT1-cvcE,1303
61
+ amsdal_ml/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
+ amsdal_ml/models/embedding_model.py,sha256=WYPkttS81T1Me39kEjrrnxXiyrfQPDBjuSV3tTWPrrI,774
63
+ amsdal_ml/prompts/__init__.py,sha256=mnts4uN_tgbcJ4fJaS_gucxFIL0WSzvG_0yvQUQ_9NA,2185
64
+ amsdal_ml/prompts/database_query_agent.prompt,sha256=XAdGg15LNmN8Mglzzsu9HnGAIpOThblTIFpHpR3p-Jk,1260
65
+ amsdal_ml/prompts/functional_calling_agent_base.prompt,sha256=dvIWT_Dl5WGr1GCgRJDwmFPxFD4jsweqnnApnsO5n5k,258
66
+ amsdal_ml/prompts/nl_query_filter.prompt,sha256=Qeh0qZd59ObAYxql3N3vSfDZc6PBnQUHD-0MIaQMbEY,15470
67
+ amsdal_ml/prompts/react_chat.prompt,sha256=KGJNaaeutqMtYQ7PBnMCuR9RQQBHBa4VzXfQ4c0D3Js,1953
68
+ amsdal_ml/utils/__init__.py,sha256=Q9ToZTkhPC6TiAx2qR_5Ap06cg94tvxorMfCU2v0xUQ,208
69
+ amsdal_ml/utils/query_utils.py,sha256=DlU1FOwabPqg4CW8xEzhel7KjuCwkYPiB41WX8s7mbc,5496
70
+ amsdal_ml-0.2.0.dist-info/METADATA,sha256=81zcR8zkC6u5XKxfMV2zaF5dAckyN_P2Q0Xr09OSvzw,8373
71
+ amsdal_ml-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
72
+ amsdal_ml-0.2.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,58 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from dataclasses import dataclass
4
- from pathlib import Path
5
- from typing import Any
6
- from typing import Final
7
-
8
- # avoid "magic numbers"
9
- _PARTS_EXPECTED: Final[int] = 2
10
-
11
-
12
- class _SafeDict(dict[str, Any]):
13
- def __missing__(self, key: str) -> str:
14
- return "{" + key + "}"
15
-
16
-
17
- @dataclass
18
- class Prompt:
19
- name: str
20
- system: str
21
- user: str
22
-
23
- def render_text(self, **kwargs: Any) -> str:
24
- data = _SafeDict(**kwargs)
25
- sys_txt = self.system.format_map(data)
26
- usr_txt = self.user.format_map(data)
27
- return f"{sys_txt}\n\n{usr_txt}".strip()
28
-
29
- def render_messages(self, **kwargs: Any) -> list[dict[str, str]]:
30
- data = _SafeDict(**kwargs)
31
- return [
32
- {"role": "system", "content": self.system.format_map(data)},
33
- {"role": "user", "content": self.user.format_map(data)},
34
- ]
35
-
36
-
37
- _prompt_cache: dict[str, Prompt] = {}
38
-
39
-
40
- def _load_file(name: str) -> Prompt:
41
- base = Path(__file__).resolve().parent
42
- path = base / f"{name}.prompt"
43
- if not path.exists():
44
- msg = f"Prompt '{name}' not found at {path}"
45
- raise FileNotFoundError(msg)
46
- raw = path.read_text(encoding="utf-8")
47
- parts = raw.split("\n---\n", 1)
48
- if len(parts) == _PARTS_EXPECTED:
49
- system, user = parts
50
- else:
51
- system, user = raw, "{input}"
52
- return Prompt(name=name, system=system.strip(), user=user.strip())
53
-
54
-
55
- def get_prompt(name: str) -> Prompt:
56
- if name not in _prompt_cache:
57
- _prompt_cache[name] = _load_file(name)
58
- return _prompt_cache[name]
@@ -1,69 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: amsdal_ml
3
- Version: 0.1.3
4
- Summary: amsdal_ml plugin for AMSDAL Framework
5
- Requires-Python: >=3.11
6
- Requires-Dist: aiohttp==3.12.15
7
- Requires-Dist: amsdal-cli>=0.5.7
8
- Requires-Dist: amsdal-data>=0.5.9
9
- Requires-Dist: amsdal-models>=0.5.9
10
- Requires-Dist: amsdal-utils>=0.5.4
11
- Requires-Dist: amsdal>=0.5.6
12
- Requires-Dist: mcp>=0.1
13
- Requires-Dist: openai==1.100.2
14
- Requires-Dist: pydantic-settings==2.10.1
15
- Requires-Dist: pydantic==2.11.7
16
- Description-Content-Type: text/markdown
17
-
18
- # amsdal-ml
19
-
20
- This plugin extends the AMSDAL Framework with machine learning utilities,
21
- including custom models for embeddings, properties for ML metadata, and
22
- hooks for working with vector search and AI-driven features.
23
-
24
- ## Plugin Structure
25
-
26
- - `src/models/` - Contains model definitions in Python format
27
- - `src/transactions/` - Contains transaction definitions
28
- - `pyproject.toml` - Plugin configuration file
29
- - `config.yml` - Configuration for connections
30
-
31
- ## Installing this Plugin
32
-
33
- To use this plugin in an AMSDAL application:
34
-
35
- 1. Copy the plugin directory to your AMSDAL application
36
- 2. Import the models and transactions as needed
37
- 3. Register the plugin in your application configuration
38
-
39
- ## Development
40
-
41
- This plugin uses sync mode.
42
-
43
- ### Adding Models
44
-
45
- ```bash
46
- amsdal generate model ModelName --format py
47
- ```
48
-
49
- ### Adding Properties
50
-
51
- ```bash
52
- amsdal generate property --model ModelName property_name
53
- ```
54
-
55
- ### Adding Transactions
56
-
57
- ```bash
58
- amsdal generate transaction TransactionName
59
- ```
60
-
61
- ### Adding Hooks
62
-
63
- ```bash
64
- amsdal generate hook --model ModelName on_create
65
- ```
66
-
67
- ## Testing
68
-
69
- Test your plugin by integrating it with an AMSDAL application and running the application's test suite.
@@ -1,39 +0,0 @@
1
- amsdal_ml/Third-Party Materials - AMSDAL Dependencies - License Notices.md,sha256=0A3jjw91I-NaTHXCw8IQiKUdFJgVavhgHaFX4Nag4jk,81658
2
- amsdal_ml/__about__.py,sha256=uZsygMXMKRw-7qhWojAjnpm8GFPXU92xW6XA8O5GwFY,22
3
- amsdal_ml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- amsdal_ml/app.py,sha256=K_lUz37_FUQmPwzDakDhVXA_D2SL9z1JtcuHfuBvlKE,184
5
- amsdal_ml/ml_config.py,sha256=UONMVG2RbKVbaYF-GdlhRQbm8flp52GxBzfqdzuLZ5w,1788
6
- amsdal_ml/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- amsdal_ml/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- amsdal_ml/agents/agent.py,sha256=L00RTIkopdGnJp_NctEtWRXAgWy1DAn7AEg0rMoXdJw,1514
9
- amsdal_ml/agents/default_qa_agent.py,sha256=MjrA5XYOKe5PwfSnkoeGmEnC8mP9asRHGHPHd1oPH6g,14017
10
- amsdal_ml/agents/retriever_tool.py,sha256=SqIGqYi_xMcm_MgLcwdMW2ALzYphkk02KBevH8n-Op0,1850
11
- amsdal_ml/agents/promts/__init__.py,sha256=3AKR3lrV067CO03XYFDmAKJv0x2oqSTcVeDIqNwoAu0,1571
12
- amsdal_ml/agents/promts/react_chat.prompt,sha256=EArdA102sSBOWchhub1QoaKws_DVpMqDflc5htBkFKI,1762
13
- amsdal_ml/fileio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- amsdal_ml/fileio/base_loader.py,sha256=rFeClp-ZkSX6Ja1vz1RutlyMqYIGgR48CrtXDWXr4Ns,1866
15
- amsdal_ml/fileio/openai_loader.py,sha256=4YyxK5pBAnRm55et5yMu6X5OdK2kWTqpuPF1E2-oFZc,2572
16
- amsdal_ml/mcp_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- amsdal_ml/mcp_client/base.py,sha256=cNuHHCSSND4BkIyhQZ-1mJLPp630wTCtiCQSHnK2zmA,441
18
- amsdal_ml/mcp_client/http_client.py,sha256=2fFCaubp_cFeyCqN9CP7bVLTp4UIIEhJPq9BVHBf6-w,1719
19
- amsdal_ml/mcp_client/stdio_client.py,sha256=F5Y2yGFNDCE7Nfg_6QMCkp81Vb4uS2UQ1XnD_FTGM8U,5777
20
- amsdal_ml/mcp_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- amsdal_ml/mcp_server/server_retriever_stdio.py,sha256=iUQNwWEDZE0OIS9vyTyJp_EOn4kvl9Gn0Okzcq-ymo0,1762
22
- amsdal_ml/migrations/0000_initial.py,sha256=UeEtqHrCgmTQyGnyV2jC7yt9Ce7Xm0-MyhOQU3rRrs8,1633
23
- amsdal_ml/ml_ingesting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
- amsdal_ml/ml_ingesting/default_ingesting.py,sha256=udVAyUbjeCrsP9pk-VbAH689M3VmBRhOFbl9Que9oK0,12859
25
- amsdal_ml/ml_ingesting/embedding_data.py,sha256=ZWxhYq8mkFVC3HMM5nEiObgy62X8hLh1McaGegnRUsk,355
26
- amsdal_ml/ml_ingesting/ingesting.py,sha256=h-GdNCtutO8C75jbLko40CMjHym9Xk_nlMdNYLfBs58,1458
27
- amsdal_ml/ml_ingesting/openai_ingesting.py,sha256=_2dU2id2a3xR_y0GvZc5LUDw3_wI-wbhEFogEOKF-H0,1421
28
- amsdal_ml/ml_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- amsdal_ml/ml_models/models.py,sha256=gZzZrjsoAnFc5pPwqqLPNh5RYxwKKaFyNg56NJnsn4w,2286
30
- amsdal_ml/ml_models/openai_model.py,sha256=yQ6r4K7AOeG3NfWT6pXgjkRPMT0FuQPqFUWeHSwz0u8,14295
31
- amsdal_ml/ml_retrievers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- amsdal_ml/ml_retrievers/default_retriever.py,sha256=ykAzi6gESyG1693nALpPJ9XhKV_We1yrNxbYo1eG748,3233
33
- amsdal_ml/ml_retrievers/openai_retriever.py,sha256=oY71oPJdFuECWaJL_ByKZFE7HRJ-S6ypRzzJ7XjI7H8,1236
34
- amsdal_ml/ml_retrievers/retriever.py,sha256=zHvaAOAD6H4IaIaYA_wy2e8tMmGtOnyNsDS2B4dQjBU,1005
35
- amsdal_ml/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- amsdal_ml/models/embedding_model.py,sha256=mdMSYHrkSIKHi5mg4HqMaTTiPGqLYtRdRkbEK_trFWw,774
37
- amsdal_ml-0.1.3.dist-info/METADATA,sha256=BETzPNugrsUz-RL3yG-2I-4I_WBSLkJ5oRJYxyZxEDY,1676
38
- amsdal_ml-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
- amsdal_ml-0.1.3.dist-info/RECORD,,