touchdb-ai 2.0.2__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.
- touchdb_ai-2.0.2/PKG-INFO +152 -0
- touchdb_ai-2.0.2/README.md +94 -0
- touchdb_ai-2.0.2/pyproject.toml +62 -0
- touchdb_ai-2.0.2/src/touchdb/__init__.py +172 -0
- touchdb_ai-2.0.2/src/touchdb/agents/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/__init__.py +17 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/agent_memory/__init__.py +21 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/agent_memory/base.py +103 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/agent_memory/models.py +53 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/file_system/__init__.py +14 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/file_system/base.py +71 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/file_system/models.py +25 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/sql_runner/__init__.py +13 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/sql_runner/base.py +37 -0
- touchdb_ai-2.0.2/src/touchdb/capabilities/sql_runner/models.py +13 -0
- touchdb_ai-2.0.2/src/touchdb/components/__init__.py +92 -0
- touchdb_ai-2.0.2/src/touchdb/components/base.py +11 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/__init__.py +83 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/containers/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/containers/card.py +20 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/data/__init__.py +9 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/data/chart.py +17 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/data/dataframe.py +93 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/feedback/__init__.py +21 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/feedback/badge.py +16 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/feedback/icon_text.py +14 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/feedback/log_viewer.py +41 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/feedback/notification.py +19 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/feedback/progress.py +37 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/feedback/status_card.py +28 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/feedback/status_indicator.py +14 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/interactive/__init__.py +21 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/interactive/button.py +95 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/interactive/task_list.py +58 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/interactive/ui_state.py +93 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/specialized/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/specialized/artifact.py +20 -0
- touchdb_ai-2.0.2/src/touchdb/components/rich/text.py +16 -0
- touchdb_ai-2.0.2/src/touchdb/components/simple/__init__.py +15 -0
- touchdb_ai-2.0.2/src/touchdb/components/simple/image.py +15 -0
- touchdb_ai-2.0.2/src/touchdb/components/simple/link.py +15 -0
- touchdb_ai-2.0.2/src/touchdb/components/simple/text.py +11 -0
- touchdb_ai-2.0.2/src/touchdb/core/__init__.py +193 -0
- touchdb_ai-2.0.2/src/touchdb/core/_compat.py +19 -0
- touchdb_ai-2.0.2/src/touchdb/core/agent/__init__.py +10 -0
- touchdb_ai-2.0.2/src/touchdb/core/agent/agent.py +1419 -0
- touchdb_ai-2.0.2/src/touchdb/core/agent/config.py +123 -0
- touchdb_ai-2.0.2/src/touchdb/core/audit/__init__.py +28 -0
- touchdb_ai-2.0.2/src/touchdb/core/audit/base.py +299 -0
- touchdb_ai-2.0.2/src/touchdb/core/audit/models.py +131 -0
- touchdb_ai-2.0.2/src/touchdb/core/component_manager.py +329 -0
- touchdb_ai-2.0.2/src/touchdb/core/components.py +53 -0
- touchdb_ai-2.0.2/src/touchdb/core/enhancer/__init__.py +11 -0
- touchdb_ai-2.0.2/src/touchdb/core/enhancer/base.py +94 -0
- touchdb_ai-2.0.2/src/touchdb/core/enhancer/default.py +118 -0
- touchdb_ai-2.0.2/src/touchdb/core/enricher/__init__.py +10 -0
- touchdb_ai-2.0.2/src/touchdb/core/enricher/base.py +59 -0
- touchdb_ai-2.0.2/src/touchdb/core/errors.py +47 -0
- touchdb_ai-2.0.2/src/touchdb/core/evaluation/__init__.py +81 -0
- touchdb_ai-2.0.2/src/touchdb/core/evaluation/base.py +186 -0
- touchdb_ai-2.0.2/src/touchdb/core/evaluation/dataset.py +254 -0
- touchdb_ai-2.0.2/src/touchdb/core/evaluation/evaluators.py +376 -0
- touchdb_ai-2.0.2/src/touchdb/core/evaluation/report.py +289 -0
- touchdb_ai-2.0.2/src/touchdb/core/evaluation/runner.py +313 -0
- touchdb_ai-2.0.2/src/touchdb/core/filter/__init__.py +10 -0
- touchdb_ai-2.0.2/src/touchdb/core/filter/base.py +67 -0
- touchdb_ai-2.0.2/src/touchdb/core/interfaces.py +19 -0
- touchdb_ai-2.0.2/src/touchdb/core/lifecycle/__init__.py +10 -0
- touchdb_ai-2.0.2/src/touchdb/core/lifecycle/base.py +83 -0
- touchdb_ai-2.0.2/src/touchdb/core/llm/__init__.py +16 -0
- touchdb_ai-2.0.2/src/touchdb/core/llm/base.py +40 -0
- touchdb_ai-2.0.2/src/touchdb/core/llm/models.py +61 -0
- touchdb_ai-2.0.2/src/touchdb/core/middleware/__init__.py +10 -0
- touchdb_ai-2.0.2/src/touchdb/core/middleware/base.py +69 -0
- touchdb_ai-2.0.2/src/touchdb/core/models.py +32 -0
- touchdb_ai-2.0.2/src/touchdb/core/observability/__init__.py +11 -0
- touchdb_ai-2.0.2/src/touchdb/core/observability/base.py +88 -0
- touchdb_ai-2.0.2/src/touchdb/core/observability/models.py +47 -0
- touchdb_ai-2.0.2/src/touchdb/core/recovery/__init__.py +11 -0
- touchdb_ai-2.0.2/src/touchdb/core/recovery/base.py +84 -0
- touchdb_ai-2.0.2/src/touchdb/core/recovery/models.py +32 -0
- touchdb_ai-2.0.2/src/touchdb/core/registry.py +292 -0
- touchdb_ai-2.0.2/src/touchdb/core/rich_component.py +156 -0
- touchdb_ai-2.0.2/src/touchdb/core/rich_components.py +6 -0
- touchdb_ai-2.0.2/src/touchdb/core/simple_component.py +27 -0
- touchdb_ai-2.0.2/src/touchdb/core/simple_components.py +6 -0
- touchdb_ai-2.0.2/src/touchdb/core/storage/__init__.py +14 -0
- touchdb_ai-2.0.2/src/touchdb/core/storage/base.py +46 -0
- touchdb_ai-2.0.2/src/touchdb/core/storage/models.py +46 -0
- touchdb_ai-2.0.2/src/touchdb/core/system_prompt/__init__.py +13 -0
- touchdb_ai-2.0.2/src/touchdb/core/system_prompt/base.py +36 -0
- touchdb_ai-2.0.2/src/touchdb/core/system_prompt/default.py +157 -0
- touchdb_ai-2.0.2/src/touchdb/core/tool/__init__.py +18 -0
- touchdb_ai-2.0.2/src/touchdb/core/tool/base.py +70 -0
- touchdb_ai-2.0.2/src/touchdb/core/tool/models.py +84 -0
- touchdb_ai-2.0.2/src/touchdb/core/user/__init__.py +19 -0
- touchdb_ai-2.0.2/src/touchdb/core/user/base.py +29 -0
- touchdb_ai-2.0.2/src/touchdb/core/user/models.py +25 -0
- touchdb_ai-2.0.2/src/touchdb/core/user/request_context.py +70 -0
- touchdb_ai-2.0.2/src/touchdb/core/user/resolver.py +61 -0
- touchdb_ai-2.0.2/src/touchdb/core/validation.py +164 -0
- touchdb_ai-2.0.2/src/touchdb/core/workflow/__init__.py +12 -0
- touchdb_ai-2.0.2/src/touchdb/core/workflow/base.py +254 -0
- touchdb_ai-2.0.2/src/touchdb/core/workflow/default.py +789 -0
- touchdb_ai-2.0.2/src/touchdb/examples/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/examples/__main__.py +44 -0
- touchdb_ai-2.0.2/src/touchdb/examples/anthropic_quickstart.py +80 -0
- touchdb_ai-2.0.2/src/touchdb/examples/artifact_example.py +293 -0
- touchdb_ai-2.0.2/src/touchdb/examples/claude_sqlite_example.py +236 -0
- touchdb_ai-2.0.2/src/touchdb/examples/coding_agent_example.py +300 -0
- touchdb_ai-2.0.2/src/touchdb/examples/custom_system_prompt_example.py +174 -0
- touchdb_ai-2.0.2/src/touchdb/examples/default_workflow_handler_example.py +208 -0
- touchdb_ai-2.0.2/src/touchdb/examples/email_auth_example.py +340 -0
- touchdb_ai-2.0.2/src/touchdb/examples/evaluation_example.py +269 -0
- touchdb_ai-2.0.2/src/touchdb/examples/extensibility_example.py +262 -0
- touchdb_ai-2.0.2/src/touchdb/examples/minimal_example.py +67 -0
- touchdb_ai-2.0.2/src/touchdb/examples/mock_auth_example.py +227 -0
- touchdb_ai-2.0.2/src/touchdb/examples/mock_custom_tool.py +311 -0
- touchdb_ai-2.0.2/src/touchdb/examples/mock_quickstart.py +79 -0
- touchdb_ai-2.0.2/src/touchdb/examples/mock_quota_example.py +145 -0
- touchdb_ai-2.0.2/src/touchdb/examples/mock_rich_components_demo.py +396 -0
- touchdb_ai-2.0.2/src/touchdb/examples/mock_sqlite_example.py +223 -0
- touchdb_ai-2.0.2/src/touchdb/examples/openai_quickstart.py +83 -0
- touchdb_ai-2.0.2/src/touchdb/examples/primitive_components_demo.py +305 -0
- touchdb_ai-2.0.2/src/touchdb/examples/quota_lifecycle_example.py +139 -0
- touchdb_ai-2.0.2/src/touchdb/examples/visualization_example.py +251 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/__init__.py +17 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/anthropic/__init__.py +9 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/anthropic/llm.py +270 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/azureopenai/__init__.py +9 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/azureopenai/llm.py +329 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/azuresearch/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/azuresearch/agent_memory.py +413 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/bigquery/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/bigquery/sql_runner.py +81 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/chromadb/__init__.py +104 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/chromadb/agent_memory.py +488 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/clickhouse/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/clickhouse/sql_runner.py +82 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/duckdb/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/duckdb/sql_runner.py +65 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/faiss/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/faiss/agent_memory.py +435 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/google/__init__.py +9 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/google/gemini.py +370 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/hive/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/hive/sql_runner.py +87 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/local/__init__.py +17 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/local/agent_memory/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/local/agent_memory/in_memory.py +285 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/local/audit.py +59 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/local/file_system.py +242 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/local/file_system_conversation_store.py +255 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/local/storage.py +62 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/marqo/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/marqo/agent_memory.py +354 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/milvus/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/milvus/agent_memory.py +458 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/mock/__init__.py +9 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/mock/llm.py +65 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/mssql/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/mssql/sql_runner.py +66 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/mysql/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/mysql/sql_runner.py +92 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/ollama/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/ollama/llm.py +252 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/openai/__init__.py +10 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/openai/llm.py +267 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/openai/responses.py +163 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/opensearch/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/opensearch/agent_memory.py +411 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/oracle/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/oracle/sql_runner.py +75 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/pinecone/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/pinecone/agent_memory.py +329 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/plotly/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/plotly/chart_generator.py +313 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/postgres/__init__.py +9 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/postgres/sql_runner.py +112 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/premium/agent_memory/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/premium/agent_memory/premium.py +186 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/presto/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/presto/sql_runner.py +107 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/qdrant/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/qdrant/agent_memory.py +466 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/snowflake/__init__.py +5 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/snowflake/sql_runner.py +147 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/sqlite/__init__.py +9 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/sqlite/sql_runner.py +65 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/weaviate/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/integrations/weaviate/agent_memory.py +428 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/ZhipuAI/ZhipuAI_Chat.py +233 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/ZhipuAI/ZhipuAI_embeddings.py +79 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/ZhipuAI/__init__.py +2 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/__init__.py +403 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/adapter.py +463 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/advanced/__init__.py +28 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/anthropic/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/anthropic/anthropic_chat.py +80 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/azuresearch/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/azuresearch/azuresearch_vector.py +274 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/base/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/base/base.py +2125 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/bedrock/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/bedrock/bedrock_converse.py +86 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/chromadb/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/chromadb/chromadb_vector.py +259 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/cohere/__init__.py +2 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/cohere/cohere_chat.py +99 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/cohere/cohere_embeddings.py +77 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/deepseek/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/deepseek/deepseek_chat.py +59 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/exceptions/__init__.py +46 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/faiss/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/faiss/faiss.py +230 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/flask/__init__.py +1343 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/flask/assets.py +58 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/flask/auth.py +56 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/google/__init__.py +2 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/google/bigquery_vector.py +282 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/google/gemini_chat.py +78 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/hf/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/hf/hf.py +80 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/local.py +8 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/marqo/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/marqo/marqo.py +168 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/milvus/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/milvus/milvus_vector.py +328 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/mistral/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/mistral/mistral.py +51 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/mock/__init__.py +3 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/mock/embedding.py +11 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/mock/llm.py +18 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/mock/vectordb.py +67 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/ollama/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/ollama/ollama.py +110 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/openai/__init__.py +2 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/openai/openai_chat.py +124 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/openai/openai_embeddings.py +46 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/opensearch/__init__.py +2 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/opensearch/opensearch_vector.py +369 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/opensearch/opensearch_vector_semantic.py +200 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/oracle/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/oracle/oracle_vector.py +584 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/pgvector/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/pgvector/pgvector.py +282 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/pinecone/__init__.py +3 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/pinecone/pinecone_vector.py +275 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/qdrant/__init__.py +3 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/qdrant/qdrant.py +329 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/qianfan/Qianfan_Chat.py +170 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/qianfan/Qianfan_embeddings.py +36 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/qianfan/__init__.py +2 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/qianwen/QianwenAI_chat.py +132 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/qianwen/QianwenAI_embeddings.py +46 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/qianwen/__init__.py +2 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/remote.py +79 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/touchdbdb/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/touchdbdb/touchdbdb_vector.py +468 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/types/__init__.py +292 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/utils.py +72 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/vllm/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/vllm/vllm.py +97 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/weaviate/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/weaviate/weaviate_vector.py +194 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/xinference/__init__.py +1 -0
- touchdb_ai-2.0.2/src/touchdb/legacy/xinference/xinference.py +53 -0
- touchdb_ai-2.0.2/src/touchdb/py.typed +0 -0
- touchdb_ai-2.0.2/src/touchdb/servers/__init__.py +16 -0
- touchdb_ai-2.0.2/src/touchdb/servers/__main__.py +8 -0
- touchdb_ai-2.0.2/src/touchdb/servers/base/__init__.py +18 -0
- touchdb_ai-2.0.2/src/touchdb/servers/base/chat_handler.py +65 -0
- touchdb_ai-2.0.2/src/touchdb/servers/base/models.py +111 -0
- touchdb_ai-2.0.2/src/touchdb/servers/base/rich_chat_handler.py +141 -0
- touchdb_ai-2.0.2/src/touchdb/servers/base/templates.py +331 -0
- touchdb_ai-2.0.2/src/touchdb/servers/cli/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/servers/cli/server_runner.py +204 -0
- touchdb_ai-2.0.2/src/touchdb/servers/fastapi/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/servers/fastapi/app.py +163 -0
- touchdb_ai-2.0.2/src/touchdb/servers/fastapi/routes.py +183 -0
- touchdb_ai-2.0.2/src/touchdb/servers/flask/__init__.py +7 -0
- touchdb_ai-2.0.2/src/touchdb/servers/flask/app.py +132 -0
- touchdb_ai-2.0.2/src/touchdb/servers/flask/routes.py +137 -0
- touchdb_ai-2.0.2/src/touchdb/tools/__init__.py +41 -0
- touchdb_ai-2.0.2/src/touchdb/tools/agent_memory.py +322 -0
- touchdb_ai-2.0.2/src/touchdb/tools/file_system.py +879 -0
- touchdb_ai-2.0.2/src/touchdb/tools/python.py +222 -0
- touchdb_ai-2.0.2/src/touchdb/tools/run_sql.py +165 -0
- touchdb_ai-2.0.2/src/touchdb/tools/visualize_data.py +195 -0
- touchdb_ai-2.0.2/src/touchdb/utils/__init__.py +0 -0
- touchdb_ai-2.0.2/src/touchdb/web_components/__init__.py +44 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: touchdb-ai
|
|
3
|
+
Version: 2.0.2
|
|
4
|
+
Summary: TouchDB AI - Generate SQL queries and perform data analytics using autonomous agents
|
|
5
|
+
Author-email: TouchDB AI Team <contact@touchdb.ai>
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Dist: pydantic>=2.0.0
|
|
12
|
+
Requires-Dist: click>=8.0.0
|
|
13
|
+
Requires-Dist: pandas
|
|
14
|
+
Requires-Dist: httpx>=0.28.0
|
|
15
|
+
Requires-Dist: PyYAML
|
|
16
|
+
Requires-Dist: plotly
|
|
17
|
+
Requires-Dist: tabulate
|
|
18
|
+
Requires-Dist: sqlparse
|
|
19
|
+
Requires-Dist: sqlalchemy
|
|
20
|
+
Requires-Dist: requests
|
|
21
|
+
Requires-Dist: anthropic ; extra == "anthropic"
|
|
22
|
+
Requires-Dist: google-cloud-bigquery ; extra == "bigquery"
|
|
23
|
+
Requires-Dist: clickhouse_connect ; extra == "clickhouse"
|
|
24
|
+
Requires-Dist: duckdb ; extra == "duckdb"
|
|
25
|
+
Requires-Dist: fastapi>=0.68.0 ; extra == "fastapi"
|
|
26
|
+
Requires-Dist: uvicorn>=0.15.0 ; extra == "fastapi"
|
|
27
|
+
Requires-Dist: flask>=2.0.0 ; extra == "flask"
|
|
28
|
+
Requires-Dist: flask-cors>=4.0.0 ; extra == "flask"
|
|
29
|
+
Requires-Dist: google-genai ; extra == "gemini"
|
|
30
|
+
Requires-Dist: google-generativeai ; extra == "google"
|
|
31
|
+
Requires-Dist: google-cloud-aiplatform ; extra == "google"
|
|
32
|
+
Requires-Dist: PyMySQL ; extra == "mysql"
|
|
33
|
+
Requires-Dist: ollama ; extra == "ollama"
|
|
34
|
+
Requires-Dist: httpx ; extra == "ollama"
|
|
35
|
+
Requires-Dist: openai ; extra == "openai"
|
|
36
|
+
Requires-Dist: psycopg2-binary ; extra == "postgres"
|
|
37
|
+
Requires-Dist: db-dtypes ; extra == "postgres"
|
|
38
|
+
Requires-Dist: touchdb-ai[flask, fastapi] ; extra == "servers"
|
|
39
|
+
Requires-Dist: snowflake-connector-python ; extra == "snowflake"
|
|
40
|
+
Project-URL: Bug Tracker, https://github.com/touchdb-ai/touchdb/issues
|
|
41
|
+
Project-URL: Homepage, https://github.com/touchdb-ai/touchdb
|
|
42
|
+
Provides-Extra: anthropic
|
|
43
|
+
Provides-Extra: bigquery
|
|
44
|
+
Provides-Extra: clickhouse
|
|
45
|
+
Provides-Extra: duckdb
|
|
46
|
+
Provides-Extra: fastapi
|
|
47
|
+
Provides-Extra: flask
|
|
48
|
+
Provides-Extra: gemini
|
|
49
|
+
Provides-Extra: google
|
|
50
|
+
Provides-Extra: mysql
|
|
51
|
+
Provides-Extra: ollama
|
|
52
|
+
Provides-Extra: openai
|
|
53
|
+
Provides-Extra: postgres
|
|
54
|
+
Provides-Extra: servers
|
|
55
|
+
Provides-Extra: snowflake
|
|
56
|
+
Provides-Extra: sqlite
|
|
57
|
+
|
|
58
|
+
# TouchDB AI 🚀
|
|
59
|
+
|
|
60
|
+
**TouchDB AI** is an open-source, user-aware Agentic framework for autonomous Text-to-SQL generation, data analysis, and conversational database intelligence.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Key Highlights
|
|
65
|
+
|
|
66
|
+
- **User-Aware Security & Multi-Tenancy**: Granular permissions, request-context user resolution, and role-based tool execution.
|
|
67
|
+
- **Pluggable Database Runners**: Native support for SQLite, DuckDB, PostgreSQL, MySQL, Snowflake, BigQuery, ClickHouse, and more.
|
|
68
|
+
- **Multi-LLM Support**: Seamless integrations with Google Gemini, OpenAI, Anthropic Claude, Ollama (local models), and custom LLM providers.
|
|
69
|
+
- **Adaptive Tool Memory**: Stores successful execution patterns in memory, getting smarter with each interaction.
|
|
70
|
+
- **Pre-built Web Server & CLI**: Built-in interactive CLI and FastAPI / Flask server components.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Quick Installation
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install -e .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Or install with database / LLM extras:
|
|
81
|
+
```bash
|
|
82
|
+
pip install -e ".[fastapi,openai,gemini]"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Quickstart Example
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
import asyncio
|
|
91
|
+
from touchdb import Agent, AgentConfig, ToolRegistry, User
|
|
92
|
+
from touchdb.core.user.resolver import UserResolver
|
|
93
|
+
from touchdb.core.user.request_context import RequestContext
|
|
94
|
+
from touchdb.integrations.local.agent_memory.in_memory import DemoAgentMemory
|
|
95
|
+
from touchdb.integrations.sqlite import SqliteRunner
|
|
96
|
+
from touchdb.tools import RunSqlTool
|
|
97
|
+
from touchdb.integrations.mock import MockLlmService
|
|
98
|
+
|
|
99
|
+
# 1. Setup Database Runner & Tool
|
|
100
|
+
runner = SqliteRunner(database_path="ecommerce.db")
|
|
101
|
+
sql_tool = RunSqlTool(sql_runner=runner)
|
|
102
|
+
|
|
103
|
+
registry = ToolRegistry()
|
|
104
|
+
registry.register_local_tool(sql_tool, access_groups=["default"])
|
|
105
|
+
|
|
106
|
+
# 2. Define User Resolver
|
|
107
|
+
class SimpleUserResolver(UserResolver):
|
|
108
|
+
async def resolve_user(self, ctx: RequestContext) -> User:
|
|
109
|
+
return User(id="user_1", username="admin", group_memberships=["default"])
|
|
110
|
+
|
|
111
|
+
# 3. Create TouchDB Agent
|
|
112
|
+
agent = Agent(
|
|
113
|
+
llm_service=MockLlmService(response_content="Querying database..."),
|
|
114
|
+
tool_registry=registry,
|
|
115
|
+
user_resolver=SimpleUserResolver(),
|
|
116
|
+
agent_memory=DemoAgentMemory(),
|
|
117
|
+
config=AgentConfig(stream_responses=False)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
# 4. Ask questions
|
|
121
|
+
async def ask(question: str):
|
|
122
|
+
async for component in agent.send_message(
|
|
123
|
+
request_context=RequestContext(),
|
|
124
|
+
message=question,
|
|
125
|
+
conversation_id="conv_1"
|
|
126
|
+
):
|
|
127
|
+
if component.rich_component and hasattr(component.rich_component, "content"):
|
|
128
|
+
print(component.rich_component.content)
|
|
129
|
+
|
|
130
|
+
asyncio.run(ask("Show top 5 sales"))
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Interactive CLI & Web Server
|
|
136
|
+
|
|
137
|
+
TouchDB AI includes an interactive CLI and web server:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Start TouchDB Server with FastAPI
|
|
141
|
+
touchdb --framework fastapi --port 8000 --example mock_custom_tool
|
|
142
|
+
|
|
143
|
+
# List available examples
|
|
144
|
+
touchdb --list-examples
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT License.
|
|
152
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# TouchDB AI 🚀
|
|
2
|
+
|
|
3
|
+
**TouchDB AI** is an open-source, user-aware Agentic framework for autonomous Text-to-SQL generation, data analysis, and conversational database intelligence.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Key Highlights
|
|
8
|
+
|
|
9
|
+
- **User-Aware Security & Multi-Tenancy**: Granular permissions, request-context user resolution, and role-based tool execution.
|
|
10
|
+
- **Pluggable Database Runners**: Native support for SQLite, DuckDB, PostgreSQL, MySQL, Snowflake, BigQuery, ClickHouse, and more.
|
|
11
|
+
- **Multi-LLM Support**: Seamless integrations with Google Gemini, OpenAI, Anthropic Claude, Ollama (local models), and custom LLM providers.
|
|
12
|
+
- **Adaptive Tool Memory**: Stores successful execution patterns in memory, getting smarter with each interaction.
|
|
13
|
+
- **Pre-built Web Server & CLI**: Built-in interactive CLI and FastAPI / Flask server components.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Quick Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install -e .
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or install with database / LLM extras:
|
|
24
|
+
```bash
|
|
25
|
+
pip install -e ".[fastapi,openai,gemini]"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Quickstart Example
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
import asyncio
|
|
34
|
+
from touchdb import Agent, AgentConfig, ToolRegistry, User
|
|
35
|
+
from touchdb.core.user.resolver import UserResolver
|
|
36
|
+
from touchdb.core.user.request_context import RequestContext
|
|
37
|
+
from touchdb.integrations.local.agent_memory.in_memory import DemoAgentMemory
|
|
38
|
+
from touchdb.integrations.sqlite import SqliteRunner
|
|
39
|
+
from touchdb.tools import RunSqlTool
|
|
40
|
+
from touchdb.integrations.mock import MockLlmService
|
|
41
|
+
|
|
42
|
+
# 1. Setup Database Runner & Tool
|
|
43
|
+
runner = SqliteRunner(database_path="ecommerce.db")
|
|
44
|
+
sql_tool = RunSqlTool(sql_runner=runner)
|
|
45
|
+
|
|
46
|
+
registry = ToolRegistry()
|
|
47
|
+
registry.register_local_tool(sql_tool, access_groups=["default"])
|
|
48
|
+
|
|
49
|
+
# 2. Define User Resolver
|
|
50
|
+
class SimpleUserResolver(UserResolver):
|
|
51
|
+
async def resolve_user(self, ctx: RequestContext) -> User:
|
|
52
|
+
return User(id="user_1", username="admin", group_memberships=["default"])
|
|
53
|
+
|
|
54
|
+
# 3. Create TouchDB Agent
|
|
55
|
+
agent = Agent(
|
|
56
|
+
llm_service=MockLlmService(response_content="Querying database..."),
|
|
57
|
+
tool_registry=registry,
|
|
58
|
+
user_resolver=SimpleUserResolver(),
|
|
59
|
+
agent_memory=DemoAgentMemory(),
|
|
60
|
+
config=AgentConfig(stream_responses=False)
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# 4. Ask questions
|
|
64
|
+
async def ask(question: str):
|
|
65
|
+
async for component in agent.send_message(
|
|
66
|
+
request_context=RequestContext(),
|
|
67
|
+
message=question,
|
|
68
|
+
conversation_id="conv_1"
|
|
69
|
+
):
|
|
70
|
+
if component.rich_component and hasattr(component.rich_component, "content"):
|
|
71
|
+
print(component.rich_component.content)
|
|
72
|
+
|
|
73
|
+
asyncio.run(ask("Show top 5 sales"))
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Interactive CLI & Web Server
|
|
79
|
+
|
|
80
|
+
TouchDB AI includes an interactive CLI and web server:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Start TouchDB Server with FastAPI
|
|
84
|
+
touchdb --framework fastapi --port 8000 --example mock_custom_tool
|
|
85
|
+
|
|
86
|
+
# List available examples
|
|
87
|
+
touchdb --list-examples
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT License.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["flit_core >=3.2,<4"]
|
|
3
|
+
build-backend = "flit_core.buildapi"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "touchdb-ai"
|
|
7
|
+
version = "2.0.2"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="TouchDB AI Team", email="contact@touchdb.ai" },
|
|
10
|
+
]
|
|
11
|
+
description = "TouchDB AI - Generate SQL queries and perform data analytics using autonomous agents"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"pydantic>=2.0.0",
|
|
21
|
+
"click>=8.0.0",
|
|
22
|
+
"pandas",
|
|
23
|
+
"httpx>=0.28.0",
|
|
24
|
+
"PyYAML",
|
|
25
|
+
"plotly",
|
|
26
|
+
"tabulate",
|
|
27
|
+
"sqlparse",
|
|
28
|
+
"sqlalchemy",
|
|
29
|
+
"requests",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
touchdb = "touchdb.servers.cli.server_runner:main"
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
"Homepage" = "https://github.com/touchdb-ai/touchdb"
|
|
37
|
+
"Bug Tracker" = "https://github.com/touchdb-ai/touchdb/issues"
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
flask = ["flask>=2.0.0", "flask-cors>=4.0.0"]
|
|
41
|
+
fastapi = ["fastapi>=0.68.0", "uvicorn>=0.15.0"]
|
|
42
|
+
servers = ["touchdb-ai[flask,fastapi]"]
|
|
43
|
+
postgres = ["psycopg2-binary", "db-dtypes"]
|
|
44
|
+
mysql = ["PyMySQL"]
|
|
45
|
+
clickhouse = ["clickhouse_connect"]
|
|
46
|
+
bigquery = ["google-cloud-bigquery"]
|
|
47
|
+
snowflake = ["snowflake-connector-python"]
|
|
48
|
+
duckdb = ["duckdb"]
|
|
49
|
+
google = ["google-generativeai", "google-cloud-aiplatform"]
|
|
50
|
+
openai = ["openai"]
|
|
51
|
+
anthropic = ["anthropic"]
|
|
52
|
+
gemini = ["google-genai"]
|
|
53
|
+
ollama = ["ollama", "httpx"]
|
|
54
|
+
sqlite = []
|
|
55
|
+
|
|
56
|
+
[tool.flit.module]
|
|
57
|
+
name = "touchdb"
|
|
58
|
+
path = "src/touchdb"
|
|
59
|
+
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
asyncio_mode = "auto"
|
|
62
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TouchDB Agents - A modular framework for building LLM agents.
|
|
3
|
+
|
|
4
|
+
This package provides a flexible framework for creating conversational AI agents
|
|
5
|
+
with tool execution, conversation management, and user scoping.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# Version information
|
|
9
|
+
__version__ = "2.0.2"
|
|
10
|
+
|
|
11
|
+
# Import core framework components
|
|
12
|
+
from .core import (
|
|
13
|
+
# Interfaces
|
|
14
|
+
Agent,
|
|
15
|
+
ConversationStore,
|
|
16
|
+
LlmService,
|
|
17
|
+
SystemPromptBuilder,
|
|
18
|
+
Tool,
|
|
19
|
+
UserService,
|
|
20
|
+
T,
|
|
21
|
+
# Models
|
|
22
|
+
Conversation,
|
|
23
|
+
LlmMessage,
|
|
24
|
+
LlmRequest,
|
|
25
|
+
LlmResponse,
|
|
26
|
+
LlmStreamChunk,
|
|
27
|
+
Message,
|
|
28
|
+
ToolCall,
|
|
29
|
+
ToolContext,
|
|
30
|
+
ToolResult,
|
|
31
|
+
ToolSchema,
|
|
32
|
+
User,
|
|
33
|
+
# UI Components
|
|
34
|
+
UiComponent,
|
|
35
|
+
SimpleComponent,
|
|
36
|
+
SimpleComponentType,
|
|
37
|
+
SimpleTextComponent,
|
|
38
|
+
SimpleImageComponent,
|
|
39
|
+
SimpleLinkComponent,
|
|
40
|
+
# Rich Components
|
|
41
|
+
ArtifactComponent,
|
|
42
|
+
BadgeComponent,
|
|
43
|
+
CardComponent,
|
|
44
|
+
DataFrameComponent,
|
|
45
|
+
IconTextComponent,
|
|
46
|
+
LogViewerComponent,
|
|
47
|
+
NotificationComponent,
|
|
48
|
+
ProgressBarComponent,
|
|
49
|
+
ProgressDisplayComponent,
|
|
50
|
+
RichTextComponent,
|
|
51
|
+
StatusCardComponent,
|
|
52
|
+
TaskListComponent,
|
|
53
|
+
# Core implementations
|
|
54
|
+
Agent,
|
|
55
|
+
AgentConfig,
|
|
56
|
+
DefaultSystemPromptBuilder,
|
|
57
|
+
DefaultWorkflowHandler,
|
|
58
|
+
ToolRegistry,
|
|
59
|
+
# Evaluation
|
|
60
|
+
Evaluator,
|
|
61
|
+
TestCase,
|
|
62
|
+
ExpectedOutcome,
|
|
63
|
+
AgentResult,
|
|
64
|
+
EvaluationResult,
|
|
65
|
+
TestCaseResult,
|
|
66
|
+
AgentVariant,
|
|
67
|
+
EvaluationRunner,
|
|
68
|
+
TrajectoryEvaluator,
|
|
69
|
+
OutputEvaluator,
|
|
70
|
+
LLMAsJudgeEvaluator,
|
|
71
|
+
EfficiencyEvaluator,
|
|
72
|
+
EvaluationReport,
|
|
73
|
+
ComparisonReport,
|
|
74
|
+
EvaluationDataset,
|
|
75
|
+
# Exceptions
|
|
76
|
+
AgentError,
|
|
77
|
+
ConversationNotFoundError,
|
|
78
|
+
LlmServiceError,
|
|
79
|
+
PermissionError,
|
|
80
|
+
ToolExecutionError,
|
|
81
|
+
ToolNotFoundError,
|
|
82
|
+
ValidationError,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# Import basic implementations
|
|
86
|
+
from .integrations import MemoryConversationStore, MockLlmService
|
|
87
|
+
|
|
88
|
+
# Main exports
|
|
89
|
+
__all__ = [
|
|
90
|
+
# Version
|
|
91
|
+
"__version__",
|
|
92
|
+
# Core interfaces
|
|
93
|
+
"Agent",
|
|
94
|
+
"Tool",
|
|
95
|
+
"LlmService",
|
|
96
|
+
"ConversationStore",
|
|
97
|
+
"UserService",
|
|
98
|
+
"SystemPromptBuilder",
|
|
99
|
+
"T",
|
|
100
|
+
# Models
|
|
101
|
+
"User",
|
|
102
|
+
"Message",
|
|
103
|
+
"Conversation",
|
|
104
|
+
"ToolCall",
|
|
105
|
+
"ToolResult",
|
|
106
|
+
"ToolContext",
|
|
107
|
+
"ToolSchema",
|
|
108
|
+
"LlmMessage",
|
|
109
|
+
"LlmRequest",
|
|
110
|
+
"LlmResponse",
|
|
111
|
+
"LlmStreamChunk",
|
|
112
|
+
# UI Components
|
|
113
|
+
"UiComponent",
|
|
114
|
+
"SimpleComponent",
|
|
115
|
+
"SimpleComponentType",
|
|
116
|
+
"SimpleTextComponent",
|
|
117
|
+
"SimpleImageComponent",
|
|
118
|
+
"SimpleLinkComponent",
|
|
119
|
+
# Rich Components
|
|
120
|
+
"ArtifactComponent",
|
|
121
|
+
"BadgeComponent",
|
|
122
|
+
"CardComponent",
|
|
123
|
+
"DataFrameComponent",
|
|
124
|
+
"IconTextComponent",
|
|
125
|
+
"LogViewerComponent",
|
|
126
|
+
"NotificationComponent",
|
|
127
|
+
"ProgressBarComponent",
|
|
128
|
+
"ProgressDisplayComponent",
|
|
129
|
+
"RichTextComponent",
|
|
130
|
+
"StatusCardComponent",
|
|
131
|
+
"TaskListComponent",
|
|
132
|
+
# Core implementations
|
|
133
|
+
"Agent",
|
|
134
|
+
"AgentConfig",
|
|
135
|
+
"ToolRegistry",
|
|
136
|
+
"DefaultSystemPromptBuilder",
|
|
137
|
+
"DefaultWorkflowHandler",
|
|
138
|
+
# Evaluation
|
|
139
|
+
"Evaluator",
|
|
140
|
+
"TestCase",
|
|
141
|
+
"ExpectedOutcome",
|
|
142
|
+
"AgentResult",
|
|
143
|
+
"EvaluationResult",
|
|
144
|
+
"TestCaseResult",
|
|
145
|
+
"AgentVariant",
|
|
146
|
+
"EvaluationRunner",
|
|
147
|
+
"TrajectoryEvaluator",
|
|
148
|
+
"OutputEvaluator",
|
|
149
|
+
"LLMAsJudgeEvaluator",
|
|
150
|
+
"EfficiencyEvaluator",
|
|
151
|
+
"EvaluationReport",
|
|
152
|
+
"ComparisonReport",
|
|
153
|
+
"EvaluationDataset",
|
|
154
|
+
# Basic implementations
|
|
155
|
+
"MemoryConversationStore",
|
|
156
|
+
"MockLlmService",
|
|
157
|
+
# Server components
|
|
158
|
+
"TouchDBFlaskServer",
|
|
159
|
+
"TouchDBFastAPIServer",
|
|
160
|
+
"ChatHandler",
|
|
161
|
+
"ChatRequest",
|
|
162
|
+
"ChatStreamChunk",
|
|
163
|
+
"ExampleAgentLoader",
|
|
164
|
+
# Exceptions
|
|
165
|
+
"AgentError",
|
|
166
|
+
"ToolExecutionError",
|
|
167
|
+
"ToolNotFoundError",
|
|
168
|
+
"PermissionError",
|
|
169
|
+
"ConversationNotFoundError",
|
|
170
|
+
"LlmServiceError",
|
|
171
|
+
"ValidationError",
|
|
172
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Capabilities module.
|
|
3
|
+
|
|
4
|
+
This package contains abstractions for tool capabilities - reusable utilities
|
|
5
|
+
that tools can compose via dependency injection.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .file_system import CommandResult, FileSearchMatch, FileSystem
|
|
9
|
+
from .sql_runner import RunSqlToolArgs, SqlRunner
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"FileSystem",
|
|
13
|
+
"FileSearchMatch",
|
|
14
|
+
"CommandResult",
|
|
15
|
+
"SqlRunner",
|
|
16
|
+
"RunSqlToolArgs",
|
|
17
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent memory capability package.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .base import AgentMemory
|
|
6
|
+
from .models import (
|
|
7
|
+
MemoryStats,
|
|
8
|
+
TextMemory,
|
|
9
|
+
TextMemorySearchResult,
|
|
10
|
+
ToolMemory,
|
|
11
|
+
ToolMemorySearchResult,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"AgentMemory",
|
|
16
|
+
"TextMemory",
|
|
17
|
+
"TextMemorySearchResult",
|
|
18
|
+
"ToolMemory",
|
|
19
|
+
"ToolMemorySearchResult",
|
|
20
|
+
"MemoryStats",
|
|
21
|
+
]
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent memory capability interface for tool usage learning.
|
|
3
|
+
|
|
4
|
+
This module contains the abstract base class for agent memory operations,
|
|
5
|
+
following the same pattern as the FileSystem interface.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from abc import ABC, abstractmethod
|
|
11
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from touchdb.core.tool import ToolContext
|
|
15
|
+
from .models import (
|
|
16
|
+
ToolMemorySearchResult,
|
|
17
|
+
TextMemory,
|
|
18
|
+
TextMemorySearchResult,
|
|
19
|
+
ToolMemory,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class AgentMemory(ABC):
|
|
24
|
+
"""Abstract base class for agent memory operations."""
|
|
25
|
+
|
|
26
|
+
@abstractmethod
|
|
27
|
+
async def save_tool_usage(
|
|
28
|
+
self,
|
|
29
|
+
question: str,
|
|
30
|
+
tool_name: str,
|
|
31
|
+
args: Dict[str, Any],
|
|
32
|
+
context: "ToolContext",
|
|
33
|
+
success: bool = True,
|
|
34
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
35
|
+
) -> None:
|
|
36
|
+
"""Save a tool usage pattern for future reference."""
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
@abstractmethod
|
|
40
|
+
async def save_text_memory(
|
|
41
|
+
self, content: str, context: "ToolContext"
|
|
42
|
+
) -> "TextMemory":
|
|
43
|
+
"""Save a free-form text memory."""
|
|
44
|
+
pass
|
|
45
|
+
|
|
46
|
+
@abstractmethod
|
|
47
|
+
async def search_similar_usage(
|
|
48
|
+
self,
|
|
49
|
+
question: str,
|
|
50
|
+
context: "ToolContext",
|
|
51
|
+
*,
|
|
52
|
+
limit: int = 10,
|
|
53
|
+
similarity_threshold: float = 0.7,
|
|
54
|
+
tool_name_filter: Optional[str] = None,
|
|
55
|
+
) -> List[ToolMemorySearchResult]:
|
|
56
|
+
"""Search for similar tool usage patterns based on a question."""
|
|
57
|
+
pass
|
|
58
|
+
|
|
59
|
+
@abstractmethod
|
|
60
|
+
async def search_text_memories(
|
|
61
|
+
self,
|
|
62
|
+
query: str,
|
|
63
|
+
context: "ToolContext",
|
|
64
|
+
*,
|
|
65
|
+
limit: int = 10,
|
|
66
|
+
similarity_threshold: float = 0.7,
|
|
67
|
+
) -> List["TextMemorySearchResult"]:
|
|
68
|
+
"""Search stored text memories based on a query."""
|
|
69
|
+
pass
|
|
70
|
+
|
|
71
|
+
@abstractmethod
|
|
72
|
+
async def get_recent_memories(
|
|
73
|
+
self, context: "ToolContext", limit: int = 10
|
|
74
|
+
) -> List[ToolMemory]:
|
|
75
|
+
"""Get recently added memories. Returns most recent memories first."""
|
|
76
|
+
pass
|
|
77
|
+
|
|
78
|
+
@abstractmethod
|
|
79
|
+
async def get_recent_text_memories(
|
|
80
|
+
self, context: "ToolContext", limit: int = 10
|
|
81
|
+
) -> List["TextMemory"]:
|
|
82
|
+
"""Fetch recently stored text memories."""
|
|
83
|
+
pass
|
|
84
|
+
|
|
85
|
+
@abstractmethod
|
|
86
|
+
async def delete_by_id(self, context: "ToolContext", memory_id: str) -> bool:
|
|
87
|
+
"""Delete a memory by its ID. Returns True if deleted, False if not found."""
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
@abstractmethod
|
|
91
|
+
async def delete_text_memory(self, context: "ToolContext", memory_id: str) -> bool:
|
|
92
|
+
"""Delete a text memory by its ID. Returns True if deleted, False if not found."""
|
|
93
|
+
pass
|
|
94
|
+
|
|
95
|
+
@abstractmethod
|
|
96
|
+
async def clear_memories(
|
|
97
|
+
self,
|
|
98
|
+
context: "ToolContext",
|
|
99
|
+
tool_name: Optional[str] = None,
|
|
100
|
+
before_date: Optional[str] = None,
|
|
101
|
+
) -> int:
|
|
102
|
+
"""Clear stored memories (tool or text). Returns number of memories deleted."""
|
|
103
|
+
pass
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Memory storage models and types.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ToolMemory(BaseModel):
|
|
11
|
+
"""Represents a stored tool usage memory."""
|
|
12
|
+
|
|
13
|
+
memory_id: Optional[str] = None
|
|
14
|
+
question: str
|
|
15
|
+
tool_name: str
|
|
16
|
+
args: Dict[str, Any]
|
|
17
|
+
timestamp: Optional[str] = None
|
|
18
|
+
success: bool = True
|
|
19
|
+
metadata: Optional[Dict[str, Any]] = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class TextMemory(BaseModel):
|
|
23
|
+
"""Represents a stored free-form text memory."""
|
|
24
|
+
|
|
25
|
+
memory_id: Optional[str] = None
|
|
26
|
+
content: str
|
|
27
|
+
timestamp: Optional[str] = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ToolMemorySearchResult(BaseModel):
|
|
31
|
+
"""Represents a search result from tool memory storage."""
|
|
32
|
+
|
|
33
|
+
memory: ToolMemory
|
|
34
|
+
similarity_score: float
|
|
35
|
+
rank: int
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class TextMemorySearchResult(BaseModel):
|
|
39
|
+
"""Represents a search result from text memory storage."""
|
|
40
|
+
|
|
41
|
+
memory: TextMemory
|
|
42
|
+
similarity_score: float
|
|
43
|
+
rank: int
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class MemoryStats(BaseModel):
|
|
47
|
+
"""Memory storage statistics."""
|
|
48
|
+
|
|
49
|
+
total_memories: int
|
|
50
|
+
unique_tools: int
|
|
51
|
+
unique_questions: int
|
|
52
|
+
success_rate: float
|
|
53
|
+
most_used_tools: Dict[str, int]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
File system capability.
|
|
3
|
+
|
|
4
|
+
This module provides abstractions for file system operations used by tools.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .base import FileSystem
|
|
8
|
+
from .models import CommandResult, FileSearchMatch
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"FileSystem",
|
|
12
|
+
"FileSearchMatch",
|
|
13
|
+
"CommandResult",
|
|
14
|
+
]
|