diff --git a/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/adapter.py b/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/adapter.py index 103ac5e08..d1e7b0d18 100644 --- a/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/adapter.py +++ b/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/adapter.py @@ -12,6 +12,7 @@ from cognee.infrastructure.llm.structured_output_framework.litellm_instructor.ll ) from cognee.infrastructure.llm.LLMGateway import LLMGateway +from cognee.infrastructure.llm.config import get_llm_config class AnthropicAdapter(LLMInterface): @@ -27,7 +28,7 @@ class AnthropicAdapter(LLMInterface): import anthropic self.aclient = instructor.patch( - create=anthropic.AsyncAnthropic().messages.create, mode=instructor.Mode.ANTHROPIC_TOOLS + create=anthropic.AsyncAnthropic(api_key=get_llm_config().llm_api_key).messages.create, mode=instructor.Mode.ANTHROPIC_TOOLS ) self.model = model @@ -57,7 +58,7 @@ class AnthropicAdapter(LLMInterface): return await self.aclient( model=self.model, - max_completion_tokens=4096, + max_tokens=4096, max_retries=5, messages=[ { diff --git a/pyproject.toml b/pyproject.toml index 6e3bd19f7..03b8cdf54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,7 +96,7 @@ gemini = ["google-generativeai>=0.8.4,<0.9"] huggingface = ["transformers>=4.46.3,<5"] ollama = ["transformers>=4.46.3,<5"] mistral = ["mistral-common>=1.5.2,<2"] -anthropic = ["anthropic>=0.26.1,<0.27"] +anthropic = ["anthropic>=0.27"] deepeval = ["deepeval>=3.0.1,<4"] posthog = ["posthog>=3.5.0,<4"] falkordb = ["falkordb>=1.0.9,<2.0.0"] diff --git a/uv.lock b/uv.lock index 4c9a6da17..9995908e3 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.10, <=3.13" resolution-markers = [ "python_full_version >= '3.13' and platform_python_implementation != 'PyPy' and sys_platform != 'emscripten'", @@ -203,7 +203,7 @@ wheels = [ [[package]] name = "anthropic" -version = "0.26.1" +version = "0.67.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, @@ -212,12 +212,11 @@ dependencies = [ { name = "jiter" }, { name = "pydantic" }, { name = "sniffio" }, - { name = "tokenizers" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/5e/9e/3907fd0c1bcae40bbf40af14f43d06c6b824f0e056ab99510873e16fb4ba/anthropic-0.26.1.tar.gz", hash = "sha256:26680ff781a6f678a30a1dccd0743631e602b23a47719439ffdef5335fa167d8", size = 827985, upload-time = "2024-05-21T17:06:38.268Z" } +sdist = { url = "https://files.pythonhosted.org/packages/09/08/ee91464cd821e6fca52d9a23be44815c95edd3c1cf1e844b2c5e85f0d57f/anthropic-0.67.0.tar.gz", hash = "sha256:d1531b210ea300c73423141d29bcee20fcd24ef9f426f6437c0a5d93fc98fb8e", size = 441639, upload-time = "2025-09-10T14:47:18.137Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/86/25/b7df779d6c015416cccb0cb5e9e69678c4f6c5e762abefdf41c1cb1d3958/anthropic-0.26.1-py3-none-any.whl", hash = "sha256:2812b9b250b551ed8a1f0a7e6ae3f005654098994f45ebca5b5808bd154c9628", size = 877601, upload-time = "2024-05-21T17:06:35.958Z" }, + { url = "https://files.pythonhosted.org/packages/5c/9d/9adbda372710918cc8271d089a2ceae4d977a125f90bc3c4b456bca4f281/anthropic-0.67.0-py3-none-any.whl", hash = "sha256:f80a81ec1132c514215f33d25edeeab1c4691ad5361b391ebb70d528b0605b55", size = 317126, upload-time = "2025-09-10T14:47:16.351Z" }, ] [[package]] @@ -807,7 +806,7 @@ wheels = [ [[package]] name = "cognee" -version = "0.3.2" +version = "0.3.3" source = { editable = "." } dependencies = [ { name = "aiofiles" }, @@ -969,7 +968,7 @@ requires-dist = [ { name = "aiohttp", specifier = ">=3.11.14,<4.0.0" }, { name = "aiosqlite", specifier = ">=0.20.0,<1.0.0" }, { name = "alembic", specifier = ">=1.13.3,<2" }, - { name = "anthropic", marker = "extra == 'anthropic'", specifier = ">=0.26.1,<0.27" }, + { name = "anthropic", marker = "extra == 'anthropic'", specifier = ">=0.27" }, { name = "asyncpg", marker = "extra == 'postgres'", specifier = ">=0.30.0,<1.0.0" }, { name = "asyncpg", marker = "extra == 'postgres-binary'", specifier = ">=0.30.0,<1.0.0" }, { name = "baml-py", specifier = ">=0.201.0,<0.202.0" },