diff --git a/core_server/env.py b/core_server/env.py index 36d07bb..23bc199 100644 --- a/core_server/env.py +++ b/core_server/env.py @@ -67,5 +67,5 @@ OPENAI_MAIN_MODEL=(str, "gpt-4o"), OPENAI_SMALL_MODEL=(str, "gpt-4o-mini"), BEDROCK_MAIN_MODEL=(str, "anthropic.claude-3-5-sonnet-20240620-v1:0"), - BEDROCK_SMALL_MODEL=(str, "anthropic.claude-3-5-haiku-20241022-v1:0"), + BEDROCK_SMALL_MODEL=(str, "us.amazon.nova-micro-v1:0") ) diff --git a/nlp_scripts/model_prediction/llm/model_prediction.py b/nlp_scripts/model_prediction/llm/model_prediction.py index 16cf343..a828d03 100644 --- a/nlp_scripts/model_prediction/llm/model_prediction.py +++ b/nlp_scripts/model_prediction/llm/model_prediction.py @@ -6,7 +6,7 @@ from dataclasses import make_dataclass, field, dataclass from pydantic import BaseModel, Field, create_model from concurrent.futures import ThreadPoolExecutor -from langchain_aws import ChatBedrock +from langchain_aws import ChatBedrock, ChatBedrockConverse from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import RunnableParallel from langchain_openai import ChatOpenAI @@ -283,7 +283,7 @@ def __predict_entry(self, excerpt: str): def select_model_instance(model_name: str): - if self.model_family == "bedrock": model = ChatBedrock(model_id=model_name, temperature=0) + if self.model_family == "bedrock": model = ChatBedrockConverse(model_id=model_name, temperature=0) elif self.model_family == "openai": model = ChatOpenAI(model=model_name, temperature=0) return model diff --git a/nlp_scripts/model_prediction/llm/utils.py b/nlp_scripts/model_prediction/llm/utils.py index 5946fd6..8a3b87d 100644 --- a/nlp_scripts/model_prediction/llm/utils.py +++ b/nlp_scripts/model_prediction/llm/utils.py @@ -14,6 +14,7 @@ def manage_description(name, description): def _sanitize_keys_with_uniqueness(key, max_length: int = 64): sanitized = re.sub(r'[^a-zA-Z0-9_-]', '_', key) + sanitized = re.sub(r'^_+', '', sanitized) # pydantic model keys can't start with _ sanitized = sanitized[:max_length] return sanitized