hammad-python 0.0.19__tar.gz → 0.0.20__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.
- {hammad_python-0.0.19 → hammad_python-0.0.20}/PKG-INFO +10 -2
- hammad_python-0.0.20/hammad/__init__.py +50 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/_internal.py +1 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cli/_runner.py +8 -8
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cli/plugins.py +55 -26
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cli/styles/utils.py +16 -8
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/__init__.py +1 -5
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/collections/__init__.py +2 -3
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/collections/collection.py +41 -22
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/collections/indexes/__init__.py +1 -1
- hammad_python-0.0.20/hammad/data/collections/indexes/qdrant/__init__.py +1 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/collections/indexes/qdrant/index.py +106 -118
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/collections/indexes/qdrant/settings.py +14 -14
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/collections/indexes/qdrant/utils.py +28 -38
- hammad_python-0.0.20/hammad/data/collections/indexes/tantivy/__init__.py +1 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/collections/indexes/tantivy/index.py +57 -59
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/collections/indexes/tantivy/settings.py +8 -19
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/collections/indexes/tantivy/utils.py +28 -52
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/models/__init__.py +2 -7
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/sql/__init__.py +1 -1
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/sql/database.py +71 -73
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/sql/types.py +37 -51
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/formatting/__init__.py +2 -1
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/formatting/json/converters.py +2 -2
- hammad_python-0.0.20/hammad/genai/__init__.py +138 -0
- hammad_python-0.0.20/hammad/genai/agents/__init__.py +47 -0
- hammad_python-0.0.20/hammad/genai/agents/agent.py +1022 -0
- hammad_python-0.0.20/hammad/genai/agents/run.py +615 -0
- hammad_python-0.0.20/hammad/genai/agents/types/__init__.py +42 -0
- hammad_python-0.0.20/hammad/genai/agents/types/agent_context.py +13 -0
- hammad_python-0.0.20/hammad/genai/agents/types/agent_event.py +128 -0
- hammad_python-0.0.20/hammad/genai/agents/types/agent_hooks.py +220 -0
- hammad_python-0.0.20/hammad/genai/agents/types/agent_messages.py +31 -0
- hammad_python-0.0.20/hammad/genai/agents/types/agent_response.py +90 -0
- hammad_python-0.0.20/hammad/genai/agents/types/agent_stream.py +242 -0
- hammad_python-0.0.20/hammad/genai/models/__init__.py +1 -0
- hammad_python-0.0.20/hammad/genai/models/embeddings/__init__.py +39 -0
- hammad_python-0.0.19/hammad/genai/embedding_models/embedding_model.py → hammad_python-0.0.20/hammad/genai/models/embeddings/model.py +45 -41
- {hammad_python-0.0.19/hammad/genai/embedding_models → hammad_python-0.0.20/hammad/genai/models/embeddings}/run.py +10 -8
- hammad_python-0.0.20/hammad/genai/models/embeddings/types/__init__.py +37 -0
- {hammad_python-0.0.19/hammad/genai/embedding_models → hammad_python-0.0.20/hammad/genai/models/embeddings/types}/embedding_model_name.py +2 -4
- {hammad_python-0.0.19/hammad/genai/embedding_models → hammad_python-0.0.20/hammad/genai/models/embeddings/types}/embedding_model_response.py +11 -4
- hammad_python-0.0.19/hammad/genai/embedding_models/embedding_model_request.py → hammad_python-0.0.20/hammad/genai/models/embeddings/types/embedding_model_run_params.py +4 -3
- hammad_python-0.0.20/hammad/genai/models/embeddings/types/embedding_model_settings.py +47 -0
- hammad_python-0.0.20/hammad/genai/models/language/__init__.py +48 -0
- hammad_python-0.0.19/hammad/genai/language_models/language_model.py → hammad_python-0.0.20/hammad/genai/models/language/model.py +481 -204
- {hammad_python-0.0.19/hammad/genai/language_models → hammad_python-0.0.20/hammad/genai/models/language}/run.py +80 -57
- hammad_python-0.0.20/hammad/genai/models/language/types/__init__.py +40 -0
- hammad_python-0.0.20/hammad/genai/models/language/types/language_model_instructor_mode.py +47 -0
- hammad_python-0.0.20/hammad/genai/models/language/types/language_model_messages.py +28 -0
- hammad_python-0.0.19/hammad/genai/language_models/_types.py → hammad_python-0.0.20/hammad/genai/models/language/types/language_model_name.py +3 -40
- {hammad_python-0.0.19/hammad/genai/language_models → hammad_python-0.0.20/hammad/genai/models/language/types}/language_model_request.py +17 -25
- {hammad_python-0.0.19/hammad/genai/language_models → hammad_python-0.0.20/hammad/genai/models/language/types}/language_model_response.py +61 -68
- {hammad_python-0.0.19/hammad/genai/language_models → hammad_python-0.0.20/hammad/genai/models/language/types}/language_model_response_chunk.py +8 -5
- hammad_python-0.0.20/hammad/genai/models/language/types/language_model_settings.py +89 -0
- hammad_python-0.0.19/hammad/genai/language_models/_streaming.py → hammad_python-0.0.20/hammad/genai/models/language/types/language_model_stream.py +221 -243
- {hammad_python-0.0.19/hammad/genai/language_models/_utils → hammad_python-0.0.20/hammad/genai/models/language/utils}/__init__.py +8 -11
- hammad_python-0.0.20/hammad/genai/models/language/utils/requests.py +421 -0
- hammad_python-0.0.19/hammad/genai/language_models/_utils/_structured_outputs.py → hammad_python-0.0.20/hammad/genai/models/language/utils/structured_outputs.py +31 -20
- hammad_python-0.0.20/hammad/genai/models/model_provider.py +4 -0
- hammad_python-0.0.19/hammad/genai/multimodal_models.py → hammad_python-0.0.20/hammad/genai/models/multimodal.py +4 -5
- hammad_python-0.0.20/hammad/genai/models/reranking.py +26 -0
- hammad_python-0.0.20/hammad/genai/types/__init__.py +1 -0
- hammad_python-0.0.20/hammad/genai/types/base.py +215 -0
- {hammad_python-0.0.19/hammad/genai/agents → hammad_python-0.0.20/hammad/genai}/types/history.py +101 -88
- hammad_python-0.0.19/hammad/genai/agents/types/tool.py → hammad_python-0.0.20/hammad/genai/types/tools.py +156 -141
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/logging/logger.py +1 -1
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/mcp/client/__init__.py +2 -3
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/mcp/client/client.py +10 -10
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/mcp/servers/__init__.py +2 -1
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/service/decorators.py +1 -3
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/web/models.py +1 -3
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/web/search/client.py +10 -22
- {hammad_python-0.0.19 → hammad_python-0.0.20}/pyproject.toml +11 -2
- {hammad_python-0.0.19 → hammad_python-0.0.20}/uv.lock +461 -416
- hammad_python-0.0.19/hammad/__init__.py +0 -180
- hammad_python-0.0.19/hammad/data/collections/indexes/qdrant/__init__.py +0 -1
- hammad_python-0.0.19/hammad/data/collections/indexes/tantivy/__init__.py +0 -1
- hammad_python-0.0.19/hammad/genai/__init__.py +0 -78
- hammad_python-0.0.19/hammad/genai/agents/__init__.py +0 -1
- hammad_python-0.0.19/hammad/genai/agents/types/__init__.py +0 -35
- hammad_python-0.0.19/hammad/genai/embedding_models/__init__.py +0 -41
- hammad_python-0.0.19/hammad/genai/language_models/__init__.py +0 -35
- hammad_python-0.0.19/hammad/genai/language_models/_utils/_completions.py +0 -131
- hammad_python-0.0.19/hammad/genai/language_models/_utils/_messages.py +0 -89
- hammad_python-0.0.19/hammad/genai/language_models/_utils/_requests.py +0 -202
- hammad_python-0.0.19/hammad/genai/rerank_models.py +0 -26
- {hammad_python-0.0.19 → hammad_python-0.0.20}/.gitignore +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/.python-version +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/LICENSE +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/README.md +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/_utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/completions/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/completions/client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/completions/create.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/completions/settings.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/completions/types.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/completions/utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/embeddings/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/embeddings/client/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/embeddings/client/base_embeddings_client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/embeddings/client/fastembed_text_embeddings_client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/embeddings/client/litellm_embeddings_client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/embeddings/create.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/ai/embeddings/types.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cache/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cache/base_cache.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cache/cache.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cache/decorators.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cache/file_cache.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cache/ttl_cache.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cli/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cli/animations.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cli/plugins.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cli/styles/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cli/styles/settings.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cli/styles/types.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/cli/styles/utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/collections/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/collections/base_collection.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/collections/collection.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/collections/searchable_collection.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/collections/vector_collection.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/configurations/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/configurations/configuration.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/databases/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/databases/database.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/base/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/base/fields.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/base/model.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/base/utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/pydantic/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/pydantic/converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/pydantic/models/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/pydantic/models/arbitrary_model.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/pydantic/models/cacheable_model.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/pydantic/models/fast_model.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/pydantic/models/function_model.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/models/pydantic/models/subscriptable_model.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/types/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/types/file.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/types/multimodal/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/types/multimodal/audio.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/types/multimodal/image.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/data/types/text.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/formatting/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/formatting/json/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/formatting/json/converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/formatting/text/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/formatting/text/converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/formatting/text/markdown.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/formatting/yaml/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/formatting/yaml/converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/logging/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/logging/decorators.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/logging/logger.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/mcp/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/mcp/client/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/mcp/client/client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/mcp/client/client_service.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/mcp/client/settings.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/mcp/servers/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/mcp/servers/launcher.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/performance/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/performance/imports.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/performance/runtime/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/performance/runtime/decorators.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/performance/runtime/run.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/py.typed +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/service/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/service/create.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/service/decorators.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/typing/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/web/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/web/http/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/web/http/client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/web/models.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/web/openapi/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/web/openapi/client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/web/search/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/web/search/client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/hammad/web/utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/ai/completions/test_ai_completions_create.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/ai/completions/test_ai_completions_types.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/cache/test_performance_cache.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/cli/test_cli_plugins_animate.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/cli/test_cli_plugins_input.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/cli/test_cli_plugins_print.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/cli/test_cli_styles_utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/data/collections/test_data_collections_searchable_collection.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/data/collections/test_data_collections_vector_collection.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/data/configuration/test_data_configuration.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/data/databases/test_data_databases_database.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/data/models/base/test_data_models_base_fields.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/data/models/base/test_data_models_base_model.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/data/models/pydantic/test_models_pydantic_converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/data/models/pydantic/test_models_pydantic_models.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/data/types/test_data_types_text.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/formatting/json/test_json_converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/formatting/text/test_text_utils_converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/formatting/text/test_text_utils_markdown_converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/logging/test_logging_decorators.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/logging/test_logging_logger.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/mcp/test_mcp_client_services.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/mcp/test_mcp_server_services.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/performance/runtime/test_performance_runtime_decorators.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/performance/runtime/test_performance_runtime_run.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/service/test_service_create_service.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/service/test_service_serve_decorator.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/service/test_service_serve_mcp_decorator.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/typing/test_typing_utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/web/test_web_toolkits_http_toolkit.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/web/test_web_toolkits_openapi_toolkit.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/deprecated/tests/web/test_web_utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cache/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cache/base_cache.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cache/cache.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cache/decorators.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cache/file_cache.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cache/ttl_cache.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cli/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cli/animations.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cli/styles/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cli/styles/settings.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/cli/styles/types.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/configurations/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/configurations/configuration.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/models/extensions/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/models/extensions/pydantic/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/models/extensions/pydantic/converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/models/fields.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/models/model.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/models/utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/types/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/types/file.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/types/multimodal/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/types/multimodal/audio.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/types/multimodal/image.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/data/types/text.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/formatting/json/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/formatting/text/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/formatting/text/converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/formatting/text/markdown.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/formatting/yaml/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/formatting/yaml/converters.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/logging/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/logging/decorators.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/mcp/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/mcp/client/client_service.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/mcp/client/settings.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/mcp/servers/launcher.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/py.typed +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/runtime/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/runtime/decorators.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/runtime/run.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/service/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/service/create.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/typing/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/web/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/web/http/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/web/http/client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/web/openapi/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/web/openapi/client.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/web/search/__init__.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/hammad/web/utils.py +0 -0
- {hammad_python-0.0.19 → hammad_python-0.0.20}/mkdocs.yml +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hammad-python
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.20
|
4
4
|
Author-email: Hammad Saeed <hammadaidev@gmail.com>
|
5
5
|
License: MIT License
|
6
6
|
|
@@ -28,12 +28,13 @@ Requires-Python: >=3.11
|
|
28
28
|
Requires-Dist: ddgs>=9.0.0
|
29
29
|
Requires-Dist: httpx>=0.28.1
|
30
30
|
Requires-Dist: msgspec>=0.19.0
|
31
|
+
Requires-Dist: nest-asyncio>=1.6.0
|
31
32
|
Requires-Dist: pydantic>=2.11.7
|
32
33
|
Requires-Dist: rich>=14.0.0
|
33
34
|
Requires-Dist: selectolax>=0.3.31
|
34
35
|
Requires-Dist: sqlalchemy>=2.0.41
|
35
36
|
Requires-Dist: tantivy>=0.24.0
|
36
|
-
Requires-Dist: tenacity>=
|
37
|
+
Requires-Dist: tenacity>=8.2.3
|
37
38
|
Requires-Dist: typing-inspect>=0.9.0
|
38
39
|
Provides-Extra: ai
|
39
40
|
Requires-Dist: instructor>=1.9.0; extra == 'ai'
|
@@ -46,6 +47,13 @@ Requires-Dist: litellm>=1.73.6; extra == 'all'
|
|
46
47
|
Requires-Dist: mcp>=1.10.1; extra == 'all'
|
47
48
|
Requires-Dist: qdrant-client>=1.14.3; extra == 'all'
|
48
49
|
Requires-Dist: uvicorn>=0.34.0; extra == 'all'
|
50
|
+
Provides-Extra: genai
|
51
|
+
Requires-Dist: fastapi>=0.115.6; extra == 'genai'
|
52
|
+
Requires-Dist: instructor>=1.9.0; extra == 'genai'
|
53
|
+
Requires-Dist: litellm>=1.73.6; extra == 'genai'
|
54
|
+
Requires-Dist: mcp>=1.10.1; extra == 'genai'
|
55
|
+
Requires-Dist: qdrant-client>=1.14.3; extra == 'genai'
|
56
|
+
Requires-Dist: uvicorn>=0.34.0; extra == 'genai'
|
49
57
|
Provides-Extra: mcp
|
50
58
|
Requires-Dist: mcp>=1.10.1; extra == 'mcp'
|
51
59
|
Provides-Extra: serve
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"""hammad-python"""
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing import TYPE_CHECKING
|
6
|
+
from ._internal import create_getattr_importer as __hammad_importer__
|
7
|
+
|
8
|
+
if TYPE_CHECKING:
|
9
|
+
# hammad.cache
|
10
|
+
from .cache import cached, Cache
|
11
|
+
|
12
|
+
# hammad.cli
|
13
|
+
from .cli import print, animate, input
|
14
|
+
|
15
|
+
# hammad.formatting
|
16
|
+
from .formatting.json import convert_to_json_schema
|
17
|
+
from .formatting.text import convert_to_text, convert_type_to_text
|
18
|
+
|
19
|
+
# hammad.logging
|
20
|
+
from .logging.logger import Logger, create_logger
|
21
|
+
from .logging.decorators import trace, trace_cls, trace_function, trace_http
|
22
|
+
|
23
|
+
|
24
|
+
__all__ = [
|
25
|
+
# hammad.cache
|
26
|
+
"cached",
|
27
|
+
"Cache",
|
28
|
+
# hammad.cli
|
29
|
+
"print",
|
30
|
+
"animate",
|
31
|
+
"input",
|
32
|
+
# hammad.formatting
|
33
|
+
"convert_to_json_schema",
|
34
|
+
"convert_to_text",
|
35
|
+
"convert_type_to_text",
|
36
|
+
# hammad.logging
|
37
|
+
"Logger",
|
38
|
+
"create_logger",
|
39
|
+
"trace",
|
40
|
+
"trace_cls",
|
41
|
+
"trace_function",
|
42
|
+
"trace_http",
|
43
|
+
]
|
44
|
+
|
45
|
+
|
46
|
+
__getattr__ = __hammad_importer__(__all__)
|
47
|
+
|
48
|
+
|
49
|
+
def __dir__() -> list[str]:
|
50
|
+
return __all__
|
@@ -35,10 +35,7 @@ if TYPE_CHECKING:
|
|
35
35
|
)
|
36
36
|
|
37
37
|
|
38
|
-
__all__ = (
|
39
|
-
"CLIRunner",
|
40
|
-
)
|
41
|
-
|
38
|
+
__all__ = ("CLIRunner",)
|
42
39
|
|
43
40
|
|
44
41
|
class CLIRunner:
|
@@ -54,7 +51,6 @@ class CLIRunner:
|
|
54
51
|
flush: bool = False,
|
55
52
|
) -> None: ...
|
56
53
|
|
57
|
-
|
58
54
|
@overload
|
59
55
|
@staticmethod
|
60
56
|
def print(
|
@@ -70,7 +66,6 @@ class CLIRunner:
|
|
70
66
|
live: "CLIStyleLiveSettings | int | None" = None,
|
71
67
|
) -> None: ...
|
72
68
|
|
73
|
-
|
74
69
|
@staticmethod
|
75
70
|
def print(
|
76
71
|
*values: object,
|
@@ -109,6 +104,7 @@ class CLIRunner:
|
|
109
104
|
Live settings object if live=True, otherwise None
|
110
105
|
"""
|
111
106
|
from ..cli import print as _run_cli_print_fn
|
107
|
+
|
112
108
|
return _run_cli_print_fn(
|
113
109
|
*values,
|
114
110
|
sep=sep,
|
@@ -171,6 +167,7 @@ class CLIRunner:
|
|
171
167
|
The user's input, potentially validated and converted according to the schema.
|
172
168
|
"""
|
173
169
|
from ..cli import input as _run_cli_input_fn
|
170
|
+
|
174
171
|
return _run_cli_input_fn(
|
175
172
|
prompt=prompt,
|
176
173
|
schema=schema,
|
@@ -188,7 +185,9 @@ class CLIRunner:
|
|
188
185
|
@staticmethod
|
189
186
|
def animate(
|
190
187
|
renderable: "RenderableType | str",
|
191
|
-
type: Literal[
|
188
|
+
type: Literal[
|
189
|
+
"flashing", "pulsing", "shaking", "typing", "spinning", "rainbow"
|
190
|
+
],
|
192
191
|
duration: Optional[float] = None,
|
193
192
|
# Animation parameters (defaults are handled by the specific animation classes)
|
194
193
|
speed: Optional[float] = None,
|
@@ -239,6 +238,7 @@ class CLIRunner:
|
|
239
238
|
vertical_overflow: How to handle vertical overflow
|
240
239
|
"""
|
241
240
|
from ..cli import animate as _run_cli_animate_fn
|
241
|
+
|
242
242
|
_run_cli_animate_fn(
|
243
243
|
renderable=renderable,
|
244
244
|
type=type,
|
@@ -262,4 +262,4 @@ class CLIRunner:
|
|
262
262
|
console=console,
|
263
263
|
screen=screen,
|
264
264
|
vertical_overflow=vertical_overflow,
|
265
|
-
)
|
265
|
+
)
|
@@ -159,6 +159,7 @@ def print(
|
|
159
159
|
title: Optional[str] = None,
|
160
160
|
expand: Optional[bool] = None,
|
161
161
|
live: "CLIStyleLiveSettings | int | None" = None,
|
162
|
+
duration: Optional[float] = None,
|
162
163
|
transient: bool = False,
|
163
164
|
new_line_start: bool = False,
|
164
165
|
) -> None:
|
@@ -190,6 +191,7 @@ def print(
|
|
190
191
|
title : Title for panel rendering.
|
191
192
|
expand : Whether to expand panel to full width.
|
192
193
|
live : A dictionary of live settings or an integer in seconds to run the print in a live renderable.
|
194
|
+
duration : The duration of the live renderable.
|
193
195
|
transient : Whether to clear the output after completion.
|
194
196
|
new_line_start : Start with a new line before printing.
|
195
197
|
|
@@ -221,6 +223,7 @@ def print(
|
|
221
223
|
and padding is None
|
222
224
|
and title is None
|
223
225
|
and expand is None
|
226
|
+
and not transient
|
224
227
|
):
|
225
228
|
builtins.print(*values, sep=sep, end=end, file=file, flush=flush)
|
226
229
|
return
|
@@ -250,7 +253,7 @@ def print(
|
|
250
253
|
|
251
254
|
live_settings: CLIStyleLiveSettings = {
|
252
255
|
"duration": float(live),
|
253
|
-
"transient":
|
256
|
+
"transient": transient, # Use the transient parameter
|
254
257
|
}
|
255
258
|
else:
|
256
259
|
live_settings = live
|
@@ -281,19 +284,41 @@ def print(
|
|
281
284
|
get_console = _get_rich_console()
|
282
285
|
Console, _ = _get_rich_console_classes()
|
283
286
|
console = get_console() if file is None else Console(file=file)
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
287
|
+
|
288
|
+
if transient:
|
289
|
+
# Use Rich's Live with transient for temporary output
|
290
|
+
import time
|
291
|
+
from rich.live import Live
|
292
|
+
|
293
|
+
# Auto-set duration to 2.5 when transient=True and duration is None
|
294
|
+
display_duration = duration if duration is not None else 2.5
|
295
|
+
|
296
|
+
with Live(
|
297
|
+
styled_content,
|
298
|
+
console=console,
|
299
|
+
refresh_per_second=1,
|
300
|
+
transient=True,
|
301
|
+
auto_refresh=False,
|
302
|
+
) as live:
|
303
|
+
live.update(styled_content)
|
304
|
+
live.refresh()
|
305
|
+
time.sleep(
|
306
|
+
display_duration
|
307
|
+
) # Use duration parameter for transient content
|
308
|
+
else:
|
309
|
+
console.print(
|
310
|
+
styled_content,
|
311
|
+
end=end,
|
312
|
+
justify=justify,
|
313
|
+
overflow=overflow,
|
314
|
+
no_wrap=no_wrap,
|
315
|
+
emoji=emoji,
|
316
|
+
markup=markup,
|
317
|
+
highlight=highlight,
|
318
|
+
width=width,
|
319
|
+
height=height,
|
320
|
+
new_line_start=new_line_start,
|
321
|
+
)
|
297
322
|
|
298
323
|
|
299
324
|
class InputError(Exception):
|
@@ -771,10 +796,10 @@ def animate(
|
|
771
796
|
animation = animations["CLIFlashingAnimation"](
|
772
797
|
renderable,
|
773
798
|
speed=speed if speed is not None else 0.5,
|
774
|
-
colors=colors,
|
799
|
+
colors=colors, # Class handles default if None
|
775
800
|
on_color=on_color if on_color is not None else "white",
|
776
801
|
off_color=off_color if off_color is not None else "dim white",
|
777
|
-
duration=duration,
|
802
|
+
duration=duration, # Base class handles default if None
|
778
803
|
)
|
779
804
|
elif type == "pulsing":
|
780
805
|
animation = animations["CLIPulsingAnimation"](
|
@@ -783,39 +808,43 @@ def animate(
|
|
783
808
|
min_opacity=min_opacity if min_opacity is not None else 0.3,
|
784
809
|
max_opacity=max_opacity if max_opacity is not None else 1.0,
|
785
810
|
color=color if color is not None else "white",
|
786
|
-
duration=duration,
|
811
|
+
duration=duration, # Base class handles default if None
|
787
812
|
)
|
788
813
|
elif type == "shaking":
|
789
814
|
animation = animations["CLIShakingAnimation"](
|
790
815
|
renderable,
|
791
816
|
intensity=intensity if intensity is not None else 1,
|
792
817
|
speed=speed if speed is not None else 0.1,
|
793
|
-
duration=duration,
|
818
|
+
duration=duration, # Base class handles default if None
|
794
819
|
)
|
795
820
|
elif type == "typing":
|
796
821
|
# Note: CLITypingAnimation expects 'text', assuming renderable is a string here.
|
797
|
-
animation = animations[
|
822
|
+
animation = animations[
|
823
|
+
"CLITypingAnimation"
|
824
|
+
](
|
798
825
|
renderable,
|
799
|
-
speed=speed
|
800
|
-
|
826
|
+
speed=speed
|
827
|
+
if speed is not None
|
828
|
+
else 0.05, # Pass animate's speed, using CLITypingAnimation's speed default
|
829
|
+
typing_speed=typing_speed, # Pass animate's typing_speed, CLITypingAnimation handles its None default
|
801
830
|
cursor=cursor if cursor is not None else "█",
|
802
831
|
show_cursor=show_cursor if show_cursor is not None else True,
|
803
|
-
duration=duration,
|
832
|
+
duration=duration, # Base class handles default if None
|
804
833
|
)
|
805
834
|
elif type == "spinning":
|
806
835
|
animation = animations["CLISpinningAnimation"](
|
807
836
|
renderable,
|
808
|
-
frames=frames,
|
837
|
+
frames=frames, # Class handles default if None
|
809
838
|
speed=speed if speed is not None else 0.1,
|
810
839
|
prefix=prefix if prefix is not None else True,
|
811
|
-
duration=duration,
|
840
|
+
duration=duration, # Base class handles default if None
|
812
841
|
)
|
813
842
|
elif type == "rainbow":
|
814
843
|
animation = animations["CLIRainbowAnimation"](
|
815
844
|
renderable,
|
816
845
|
speed=speed if speed is not None else 0.5,
|
817
|
-
colors=colors,
|
818
|
-
duration=duration,
|
846
|
+
colors=colors, # Class handles default if None
|
847
|
+
duration=duration, # Base class handles default if None
|
819
848
|
)
|
820
849
|
else:
|
821
850
|
raise ValueError(f"Unknown animation type: {type}")
|
@@ -119,8 +119,8 @@ def style_renderable(
|
|
119
119
|
style_settings: CLIStyleRenderableSettings | None = None,
|
120
120
|
bg: CLIStyleBackgroundType | None = None,
|
121
121
|
bg_settings: CLIStyleBackgroundSettings | None = None,
|
122
|
-
border
|
123
|
-
padding
|
122
|
+
border=None,
|
123
|
+
padding=None,
|
124
124
|
title: str | None = None,
|
125
125
|
expand: bool | None = None,
|
126
126
|
):
|
@@ -383,7 +383,7 @@ def style_renderable(
|
|
383
383
|
except Exception:
|
384
384
|
# Skip property if processing fails
|
385
385
|
continue
|
386
|
-
|
386
|
+
|
387
387
|
# Handle direct panel parameters
|
388
388
|
if title is not None:
|
389
389
|
panel_kwargs["title"] = title
|
@@ -394,6 +394,7 @@ def style_renderable(
|
|
394
394
|
if border is not None:
|
395
395
|
try:
|
396
396
|
from rich import box as rich_box_module
|
397
|
+
|
397
398
|
box_map = {
|
398
399
|
"ascii": rich_box_module.ASCII,
|
399
400
|
"ascii2": rich_box_module.ASCII2,
|
@@ -516,7 +517,7 @@ def style_renderable(
|
|
516
517
|
panel_kwargs = {}
|
517
518
|
bg_style = Style(bgcolor=bg)
|
518
519
|
panel_kwargs["style"] = bg_style
|
519
|
-
|
520
|
+
|
520
521
|
# Handle direct panel parameters even with simple bg
|
521
522
|
if title is not None:
|
522
523
|
panel_kwargs["title"] = title
|
@@ -527,6 +528,7 @@ def style_renderable(
|
|
527
528
|
if border is not None:
|
528
529
|
try:
|
529
530
|
from rich import box as rich_box_module
|
531
|
+
|
530
532
|
box_map = {
|
531
533
|
"ascii": rich_box_module.ASCII,
|
532
534
|
"ascii2": rich_box_module.ASCII2,
|
@@ -558,17 +560,22 @@ def style_renderable(
|
|
558
560
|
except Exception:
|
559
561
|
# Use default box if box processing fails
|
560
562
|
pass
|
561
|
-
|
563
|
+
|
562
564
|
return Panel(styled_renderable, **panel_kwargs)
|
563
565
|
except Exception:
|
564
566
|
# Fallback to styled renderable if panel creation fails
|
565
567
|
return styled_renderable
|
566
568
|
else:
|
567
569
|
# Handle panel parameters without background
|
568
|
-
if
|
570
|
+
if (
|
571
|
+
title is not None
|
572
|
+
or padding is not None
|
573
|
+
or expand is not None
|
574
|
+
or border is not None
|
575
|
+
):
|
569
576
|
try:
|
570
577
|
panel_kwargs = {}
|
571
|
-
|
578
|
+
|
572
579
|
if title is not None:
|
573
580
|
panel_kwargs["title"] = title
|
574
581
|
if padding is not None:
|
@@ -578,6 +585,7 @@ def style_renderable(
|
|
578
585
|
if border is not None:
|
579
586
|
try:
|
580
587
|
from rich import box as rich_box_module
|
588
|
+
|
581
589
|
box_map = {
|
582
590
|
"ascii": rich_box_module.ASCII,
|
583
591
|
"ascii2": rich_box_module.ASCII2,
|
@@ -609,7 +617,7 @@ def style_renderable(
|
|
609
617
|
except Exception:
|
610
618
|
# Use default box if box processing fails
|
611
619
|
pass
|
612
|
-
|
620
|
+
|
613
621
|
return Panel(styled_renderable, **panel_kwargs)
|
614
622
|
except Exception:
|
615
623
|
# Fallback to styled renderable if panel creation fails
|
@@ -47,7 +47,6 @@ __all__ = (
|
|
47
47
|
# hammad.data.types
|
48
48
|
"BaseText",
|
49
49
|
"Text",
|
50
|
-
|
51
50
|
# hammad.data.models
|
52
51
|
"Model",
|
53
52
|
"model_settings",
|
@@ -55,7 +54,6 @@ __all__ = (
|
|
55
54
|
"validator",
|
56
55
|
"is_field",
|
57
56
|
"is_model",
|
58
|
-
|
59
57
|
# hammad.data.collections
|
60
58
|
"Collection",
|
61
59
|
"TantivyCollectionIndex",
|
@@ -64,12 +62,10 @@ __all__ = (
|
|
64
62
|
"TantivyCollectionIndexQuerySettings",
|
65
63
|
"QdrantCollectionIndexSettings",
|
66
64
|
"QdrantCollectionIndexQuerySettings",
|
67
|
-
|
68
65
|
# hammad.data.sql
|
69
66
|
"DatabaseItemType",
|
70
67
|
"DatabaseItem",
|
71
68
|
"Database",
|
72
|
-
|
73
69
|
# hammad.data.configurations
|
74
70
|
"Configuration",
|
75
71
|
)
|
@@ -80,4 +76,4 @@ __getattr__ = create_getattr_importer(__all__)
|
|
80
76
|
|
81
77
|
def __dir__() -> list[str]:
|
82
78
|
"""Get the attributes of the hammad.data module."""
|
83
|
-
return list(__all__)
|
79
|
+
return list(__all__)
|
@@ -5,7 +5,7 @@ from ..._internal import create_getattr_importer
|
|
5
5
|
|
6
6
|
if TYPE_CHECKING:
|
7
7
|
from .collection import Collection
|
8
|
-
|
8
|
+
|
9
9
|
from .indexes import (
|
10
10
|
TantivyCollectionIndex,
|
11
11
|
QdrantCollectionIndex,
|
@@ -25,7 +25,6 @@ if TYPE_CHECKING:
|
|
25
25
|
__all__ = (
|
26
26
|
# hammad.data.collections.collection
|
27
27
|
"Collection",
|
28
|
-
|
29
28
|
# hammad.data.collections.indexes
|
30
29
|
"TantivyCollectionIndex",
|
31
30
|
"QdrantCollectionIndex",
|
@@ -41,4 +40,4 @@ __getattr__ = create_getattr_importer(__all__)
|
|
41
40
|
|
42
41
|
def __dir__() -> list[str]:
|
43
42
|
"""Get the attributes of the hammad.data.collections module."""
|
44
|
-
return list(__all__)
|
43
|
+
return list(__all__)
|
@@ -28,7 +28,7 @@ if TYPE_CHECKING:
|
|
28
28
|
DistanceMetric,
|
29
29
|
)
|
30
30
|
from ..sql.types import DatabaseItemType
|
31
|
-
from ...genai.
|
31
|
+
from ...genai.models.embeddings.types import EmbeddingModelName
|
32
32
|
else:
|
33
33
|
from .indexes.tantivy.index import TantivyCollectionIndex
|
34
34
|
from .indexes.qdrant.index import QdrantCollectionIndex, VectorSearchResult
|
@@ -44,11 +44,11 @@ class Collection:
|
|
44
44
|
"""
|
45
45
|
A unified collection factory that creates the appropriate collection index type
|
46
46
|
based on the provided parameters.
|
47
|
-
|
47
|
+
|
48
48
|
This class acts as a factory and doesn't contain its own logic - it simply
|
49
49
|
returns instances of TantivyCollectionIndex or QdrantCollectionIndex based on the
|
50
50
|
vector parameter.
|
51
|
-
|
51
|
+
|
52
52
|
The main difference from the old approach is that now collections are 'unified'
|
53
53
|
- there's no separate collections interface. Each collection directly uses either
|
54
54
|
a Tantivy or Qdrant index with SQL Database as the storage backend.
|
@@ -83,7 +83,9 @@ class Collection:
|
|
83
83
|
distance_metric: "DistanceMetric" = "dot",
|
84
84
|
settings: Optional["QdrantCollectionIndexSettings"] = None,
|
85
85
|
query_settings: Optional["QdrantCollectionIndexQuerySettings"] = None,
|
86
|
-
embedding_model: Optional[
|
86
|
+
embedding_model: Optional[
|
87
|
+
"EmbeddingModelName"
|
88
|
+
] = "openai/text-embedding-3-small",
|
87
89
|
embedding_dimensions: Optional[int] = None,
|
88
90
|
embedding_api_key: Optional[str] = None,
|
89
91
|
embedding_base_url: Optional[str] = None,
|
@@ -105,11 +107,20 @@ class Collection:
|
|
105
107
|
# Tantivy-specific parameters
|
106
108
|
fast: bool = True,
|
107
109
|
# Unified settings parameters
|
108
|
-
settings: Optional[
|
109
|
-
|
110
|
+
settings: Optional[
|
111
|
+
Union["TantivyCollectionIndexSettings", "QdrantCollectionIndexSettings"]
|
112
|
+
] = None,
|
113
|
+
query_settings: Optional[
|
114
|
+
Union[
|
115
|
+
"TantivyCollectionIndexQuerySettings",
|
116
|
+
"QdrantCollectionIndexQuerySettings",
|
117
|
+
]
|
118
|
+
] = None,
|
110
119
|
# Vector/Qdrant-specific parameters
|
111
120
|
distance_metric: "DistanceMetric" = "dot",
|
112
|
-
embedding_model: Optional[
|
121
|
+
embedding_model: Optional[
|
122
|
+
"EmbeddingModelName"
|
123
|
+
] = "openai/text-embedding-3-small",
|
113
124
|
embedding_dimensions: Optional[int] = None,
|
114
125
|
embedding_api_key: Optional[str] = None,
|
115
126
|
embedding_base_url: Optional[str] = None,
|
@@ -120,7 +131,7 @@ class Collection:
|
|
120
131
|
) -> Union["TantivyCollectionIndex", "QdrantCollectionIndex"]:
|
121
132
|
"""
|
122
133
|
Create a collection of the specified type.
|
123
|
-
|
134
|
+
|
124
135
|
Args:
|
125
136
|
name: Name of the collection
|
126
137
|
schema: Optional schema type for validation
|
@@ -128,26 +139,26 @@ class Collection:
|
|
128
139
|
path: File path for storage (None = in-memory)
|
129
140
|
vector: Whether this is a vector collection (True) or text search collection (False)
|
130
141
|
vector_size: Size of vectors (required for vector collections)
|
131
|
-
|
142
|
+
|
132
143
|
# Tantivy parameters (for non-vector collections):
|
133
144
|
fast: Whether to use fast schema building & indexing
|
134
|
-
|
145
|
+
|
135
146
|
# Unified parameters:
|
136
147
|
settings: Collection settings (TantivyCollectionIndexSettings or QdrantCollectionIndexSettings)
|
137
148
|
query_settings: Query behavior settings (TantivyCollectionIndexQuerySettings or QdrantCollectionIndexQuerySettings)
|
138
|
-
|
149
|
+
|
139
150
|
# Qdrant parameters (for vector collections):
|
140
151
|
distance_metric: Distance metric for similarity search
|
141
152
|
embedding_model: The embedding model to use (e.g., 'openai/text-embedding-3-small')
|
142
153
|
embedding_dimensions: Number of dimensions for embeddings
|
143
154
|
embedding_api_key: API key for the embedding service
|
144
155
|
embedding_base_url: Base URL for the embedding service
|
145
|
-
|
156
|
+
|
146
157
|
# Rerank parameters (for vector collections):
|
147
158
|
rerank_model: The rerank model to use (e.g., 'cohere/rerank-english-v3.0')
|
148
159
|
rerank_api_key: API key for the rerank service
|
149
160
|
rerank_base_url: Base URL for the rerank service
|
150
|
-
|
161
|
+
|
151
162
|
Returns:
|
152
163
|
A TantivyCollectionIndex or QdrantCollectionIndex instance
|
153
164
|
"""
|
@@ -181,7 +192,7 @@ class Collection:
|
|
181
192
|
settings=settings,
|
182
193
|
query_settings=query_settings,
|
183
194
|
)
|
184
|
-
|
195
|
+
|
185
196
|
|
186
197
|
@overload
|
187
198
|
def create_collection(
|
@@ -197,6 +208,7 @@ def create_collection(
|
|
197
208
|
query_settings: Optional["TantivyCollectionIndexQuerySettings"] = None,
|
198
209
|
) -> "TantivyCollectionIndex": ...
|
199
210
|
|
211
|
+
|
200
212
|
@overload
|
201
213
|
def create_collection(
|
202
214
|
name: str = "default",
|
@@ -213,6 +225,7 @@ def create_collection(
|
|
213
225
|
embedding_function: Optional[Callable[[Any], List[float]]] = None,
|
214
226
|
) -> "QdrantCollectionIndex": ...
|
215
227
|
|
228
|
+
|
216
229
|
def create_collection(
|
217
230
|
name: str = "default",
|
218
231
|
*,
|
@@ -224,8 +237,14 @@ def create_collection(
|
|
224
237
|
# Tantivy-specific parameters
|
225
238
|
fast: bool = True,
|
226
239
|
# Unified settings parameters
|
227
|
-
settings: Optional[
|
228
|
-
|
240
|
+
settings: Optional[
|
241
|
+
Union["TantivyCollectionIndexSettings", "QdrantCollectionIndexSettings"]
|
242
|
+
] = None,
|
243
|
+
query_settings: Optional[
|
244
|
+
Union[
|
245
|
+
"TantivyCollectionIndexQuerySettings", "QdrantCollectionIndexQuerySettings"
|
246
|
+
]
|
247
|
+
] = None,
|
229
248
|
# Vector/Qdrant-specific parameters
|
230
249
|
distance_metric: "DistanceMetric" = "dot",
|
231
250
|
embedding_function: Optional[Callable[[Any], List[float]]] = None,
|
@@ -233,7 +252,7 @@ def create_collection(
|
|
233
252
|
"""
|
234
253
|
Create a data collection of the specified type. Collections are a unified
|
235
254
|
interface for creating searchable, vectorizable data stores.
|
236
|
-
|
255
|
+
|
237
256
|
Args:
|
238
257
|
name: Name of the collection
|
239
258
|
schema: Optional schema type for validation
|
@@ -241,21 +260,21 @@ def create_collection(
|
|
241
260
|
path: File path for storage (None = in-memory)
|
242
261
|
vector: Whether this is a vector collection (True) or text search collection (False)
|
243
262
|
vector_size: Size of vectors (required for vector collections)
|
244
|
-
|
263
|
+
|
245
264
|
# Tantivy parameters (for non-vector collections):
|
246
265
|
fast: Whether to use fast schema building & indexing
|
247
|
-
|
266
|
+
|
248
267
|
# Unified parameters:
|
249
268
|
settings: Collection settings (TantivyCollectionIndexSettings or QdrantCollectionIndexSettings)
|
250
269
|
query_settings: Query behavior settings (TantivyCollectionIndexQuerySettings or QdrantCollectionIndexQuerySettings)
|
251
|
-
|
270
|
+
|
252
271
|
# Qdrant parameters (for vector collections):
|
253
272
|
distance_metric: Distance metric for similarity search
|
254
273
|
embedding_model: The embedding model to use (e.g., 'openai/text-embedding-3-small')
|
255
274
|
embedding_dimensions: Number of dimensions for embeddings
|
256
275
|
embedding_api_key: API key for the embedding service
|
257
276
|
embedding_base_url: Base URL for the embedding service
|
258
|
-
|
277
|
+
|
259
278
|
Returns:
|
260
279
|
A TantivyCollectionIndex or QdrantCollectionIndex instance
|
261
280
|
"""
|
@@ -271,4 +290,4 @@ def create_collection(
|
|
271
290
|
query_settings=query_settings,
|
272
291
|
distance_metric=distance_metric,
|
273
292
|
embedding_function=embedding_function,
|
274
|
-
)
|
293
|
+
)
|
@@ -0,0 +1 @@
|
|
1
|
+
"""hammad.lib.data.collections.indexes.qdrant"""
|