From 66402fbdf8e42f850625c4ddee082008c76b0126 Mon Sep 17 00:00:00 2001 From: Vadim Liventsev Date: Tue, 2 Jul 2024 12:58:23 +0200 Subject: [PATCH] smart max_retries for claude --- seidr/llm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seidr/llm.py b/seidr/llm.py index 5ab2f00..9a000e3 100644 --- a/seidr/llm.py +++ b/seidr/llm.py @@ -4,6 +4,7 @@ from langchain.chains import LLMChain from langchain.chat_models import ChatOpenAI, ChatOllama from langchain_anthropic import ChatAnthropic +import anthropic._constants from collections.abc import Iterable from typing import Callable, Optional import re @@ -85,7 +86,7 @@ def create_chain( model_name=model_name, temperature=temperature, anthropic_api_key=os.getenv('ANTHROPIC_API_KEY'), - max_retries=4096 + max_retries=int(25 * 60 * 60 / anthropic._constants.MAX_RETRY_DELAY) ) elif api == ChatOllama: chat_model = ChatOllama(