From ecfc45f4311d60b2183db68d565845b9ee2f04bc Mon Sep 17 00:00:00 2001 From: Daniel Chalef <131175+danielchalef@users.noreply.github.com> Date: Sun, 22 Sep 2024 11:28:27 -0700 Subject: [PATCH] Override default max tokens for Anthropic and Groq clients --- graphiti_core/llm_client/anthropic_client.py | 3 ++- graphiti_core/llm_client/groq_client.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/graphiti_core/llm_client/anthropic_client.py b/graphiti_core/llm_client/anthropic_client.py index 548569e..3dc8710 100644 --- a/graphiti_core/llm_client/anthropic_client.py +++ b/graphiti_core/llm_client/anthropic_client.py @@ -40,7 +40,8 @@ def __init__(self, config: LLMConfig | None = None, cache: bool = False): super().__init__(config, cache) # Override the default max tokens for Anthropic - self.max_tokens = DEFAULT_MAX_TOKENS + if self.max_tokens is None: + self.max_tokens = DEFAULT_MAX_TOKENS self.client = AsyncAnthropic( api_key=config.api_key, diff --git a/graphiti_core/llm_client/groq_client.py b/graphiti_core/llm_client/groq_client.py index 0fa3d76..adbcbd8 100644 --- a/graphiti_core/llm_client/groq_client.py +++ b/graphiti_core/llm_client/groq_client.py @@ -41,7 +41,8 @@ def __init__(self, config: LLMConfig | None = None, cache: bool = False): super().__init__(config, cache) # Override the default max tokens for Groq - self.max_tokens = DEFAULT_MAX_TOKENS + if self.max_tokens is None: + self.max_tokens = DEFAULT_MAX_TOKENS self.client = AsyncGroq(api_key=config.api_key)