From 2d842dcd4a8a33f27b831b4fbc85c0962b698e20 Mon Sep 17 00:00:00 2001 From: neagualexa Date: Mon, 22 Sep 2025 16:13:51 +0100 Subject: [PATCH 1/5] try fix max_retries from google call --- src/agents/llm_factory.py | 1 + src/module.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/agents/llm_factory.py b/src/agents/llm_factory.py index 5b6b1d5..75fcba6 100644 --- a/src/agents/llm_factory.py +++ b/src/agents/llm_factory.py @@ -79,6 +79,7 @@ def __init__(self, temperature: int = 0): model=os.environ['GOOGLE_AI_MODEL'], temperature=temperature, google_api_key=os.environ['GOOGLE_AI_API_KEY'], + max_retries=0, ) def get_llm(self): diff --git a/src/module.py b/src/module.py index 2b7b2b4..02c6f66 100755 --- a/src/module.py +++ b/src/module.py @@ -1,6 +1,7 @@ import time from typing import Any -from lf_toolkit.chat import ChatResult as Result, ChatParams as Params +from lf_toolkit.chat.result import ChatResult as Result +from lf_toolkit.chat.params import ChatParams as Params try: from .agents.utils.parse_json_context_to_prompt import parse_json_to_prompt From 2f5b51eb34a0e66a8eef7895713b2f7d3347e900 Mon Sep 17 00:00:00 2001 From: neagualexa Date: Mon, 22 Sep 2025 16:21:42 +0100 Subject: [PATCH 2/5] try fix llm with retry --- src/agents/llm_factory.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/agents/llm_factory.py b/src/agents/llm_factory.py index 75fcba6..6b2efc8 100644 --- a/src/agents/llm_factory.py +++ b/src/agents/llm_factory.py @@ -79,8 +79,13 @@ def __init__(self, temperature: int = 0): model=os.environ['GOOGLE_AI_MODEL'], temperature=temperature, google_api_key=os.environ['GOOGLE_AI_API_KEY'], - max_retries=0, + ) + + # This wrapper will catch errors and retry the call itself. + # It does NOT pass 'max_retries' to the underlying model. + self._google_llm_with_retries = self._google_llm.with_retry( + stop_after_attempt=1, # Corresponds to max_retries ) def get_llm(self): - return self._google_llm \ No newline at end of file + return self._google_llm_with_retries \ No newline at end of file From 217977e4d88c7039b8f6aadc24930ed214474042 Mon Sep 17 00:00:00 2001 From: neagualexa Date: Tue, 23 Sep 2025 09:27:30 +0100 Subject: [PATCH 3/5] test set versions for packages --- .github/workflows/dev.yml | 1 + requirements.txt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 1191a86..05a6e84 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -45,6 +45,7 @@ jobs: run: | pip install --upgrade pip pip install -r requirements.txt + pip list - name: Run tests if: always() diff --git a/requirements.txt b/requirements.txt index cca5d47..d13b034 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,12 +2,12 @@ langchain langchain-chroma langchain-community langchain-core -langchain-openai -langchain_google_genai +langchain-openai==0.3.33 +langchain_google_genai==2.1.12 langchain-text-splitters langchainhub langdetect -langgraph +langgraph==0.6.7 langsmith lf_toolkit[ipc] @ git+https://github.com/lambda-feedback/toolkit-python.git@main From 9aa889bcf4721ec92278fb00c462201b12306a7c Mon Sep 17 00:00:00 2001 From: neagualexa Date: Tue, 23 Sep 2025 09:34:09 +0100 Subject: [PATCH 4/5] revert testing changes --- .github/workflows/dev.yml | 1 - requirements.txt | 6 +++--- src/agents/llm_factory.py | 8 +------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 05a6e84..1191a86 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -45,7 +45,6 @@ jobs: run: | pip install --upgrade pip pip install -r requirements.txt - pip list - name: Run tests if: always() diff --git a/requirements.txt b/requirements.txt index d13b034..cca5d47 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,12 +2,12 @@ langchain langchain-chroma langchain-community langchain-core -langchain-openai==0.3.33 -langchain_google_genai==2.1.12 +langchain-openai +langchain_google_genai langchain-text-splitters langchainhub langdetect -langgraph==0.6.7 +langgraph langsmith lf_toolkit[ipc] @ git+https://github.com/lambda-feedback/toolkit-python.git@main diff --git a/src/agents/llm_factory.py b/src/agents/llm_factory.py index 6b2efc8..5b6b1d5 100644 --- a/src/agents/llm_factory.py +++ b/src/agents/llm_factory.py @@ -80,12 +80,6 @@ def __init__(self, temperature: int = 0): temperature=temperature, google_api_key=os.environ['GOOGLE_AI_API_KEY'], ) - - # This wrapper will catch errors and retry the call itself. - # It does NOT pass 'max_retries' to the underlying model. - self._google_llm_with_retries = self._google_llm.with_retry( - stop_after_attempt=1, # Corresponds to max_retries - ) def get_llm(self): - return self._google_llm_with_retries \ No newline at end of file + return self._google_llm \ No newline at end of file From fbedbc52c5b824acb2fadc32e812c0fb9a513616 Mon Sep 17 00:00:00 2001 From: neagualexa Date: Tue, 23 Sep 2025 09:45:26 +0100 Subject: [PATCH 5/5] update readme to match template --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7589c17..99e6906 100755 --- a/README.md +++ b/README.md @@ -62,7 +62,13 @@ git clone You're ready to start developing your chat function. Head over to the [Development](#development) section to learn more. -#### 4. Update the README +#### 4. Deploy the chat function + +You will have to add your API key and LLM model name into the Github repo settings. Under `Secrets and variables/Actions`: the API key must be added as a secret and the LLM model must be added as a variable. + +You must ensure the same namings as in your `.env` file. So, make sure to update the `.github/{dev and main}.yml` files with the correct parameter names. + +#### 5. Update the README In the `README.md` file, change the title and description so it fits the purpose of your chat function.