From 7c199bf05fb7a6c0e3ab66988f66c48fb2d06b0c Mon Sep 17 00:00:00 2001 From: corradodebari Date: Fri, 15 Nov 2024 12:50:55 +0100 Subject: [PATCH 1/2] top_p/check_hybrid --- app/src/modules/metadata.py | 14 +++++++------- app/src/modules/st_common.py | 8 +++----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/src/modules/metadata.py b/app/src/modules/metadata.py index 4abfd12..1132121 100644 --- a/app/src/modules/metadata.py +++ b/app/src/modules/metadata.py @@ -95,7 +95,7 @@ def ll_models(): "openai_compat": False, "context_length": 127072, "temperature": [0.3, 0.3, 0.0, 2.0], - "top_p": [0.75, 0.75, 0.0, 1.0], + "top_p": [1.0, 1.0, 0.0, 1.0], "max_tokens": [100, 100, 1, 4096], "frequency_penalty": [0.0, 0.0, -1.0, 1.0], "presence_penalty": [0.0, 0.0, -2.0, 2.0], @@ -108,7 +108,7 @@ def ll_models(): "openai_compat": True, "context_length": 4191, "temperature": [1.0, 1.0, 0.0, 2.0], - "top_p": [0.9, 0.9, 0.0, 1.0], + "top_p": [1.0, 1.0, 0.0, 1.0], "max_tokens": [256, 256, 1, 4096], "frequency_penalty": [0.0, 0.0, -1.0, 1.0], "presence_penalty": [0.0, 0.0, -2.0, 2.0], @@ -121,7 +121,7 @@ def ll_models(): "openai_compat": True, "context_length": 127072, "temperature": [1.0, 1.0, 0.0, 2.0], - "top_p": [0.9, 0.9, 0.0, 1.0], + "top_p": [1.0, 1.0, 0.0, 1.0], "max_tokens": [256, 256, 1, 4096], "frequency_penalty": [0.0, 0.0, -1.0, 1.0], "presence_penalty": [0.0, 0.0, -2.0, 2.0], @@ -134,7 +134,7 @@ def ll_models(): "openai_compat": True, "context_length": 127072, "temperature": [1.0, 1.0, 0.0, 2.0], - "top_p": [0.9, 0.9, 0.0, 1.0], + "top_p": [1.0, 1.0, 0.0, 1.0], "max_tokens": [256, 256, 1, 8191], "frequency_penalty": [0.0, 0.0, -1.0, 1.0], "presence_penalty": [0.0, 0.0, -2.0, 2.0], @@ -147,7 +147,7 @@ def ll_models(): "openai_compat": True, "context_length": 127072, "temperature": [1.0, 1.0, 0.0, 2.0], - "top_p": [0.9, 0.9, 0.0, 1.0], + "top_p": [1.0, 1.0, 0.0, 1.0], "max_tokens": [256, 256, 1, 4095], "frequency_penalty": [0.0, 0.0, -1.0, 1.0], "presence_penalty": [0.0, 0.0, -2.0, 2.0], @@ -160,7 +160,7 @@ def ll_models(): "openai_compat": False, "context_length": 127072, "temperature": [0.2, 0.2, 0.0, 2.0], - "top_p": [0.9, 0.9, 0.0, 1.0], + "top_p": [1.0, 1.0, 0.0, 1.0], "max_tokens": [256, 256, 1, 28000], "frequency_penalty": [0.0, 0.0, -1.0, 1.0], "presence_penalty": [0.0, 0.0, -2.0, 2.0], @@ -173,7 +173,7 @@ def ll_models(): "openai_compat": False, "context_length": 127072, "temperature": [0.2, 0.2, 0.0, 2.0], - "top_p": [0.9, 0.9, 0.0, 1.0], + "top_p": [1.0, 1.0, 0.0, 1.0], "max_tokens": [256, 256, 1, 28000], "frequency_penalty": [0.0, 0.0, -1.0, 1.0], "presence_penalty": [0.0, 0.0, -2.0, 2.0], diff --git a/app/src/modules/st_common.py b/app/src/modules/st_common.py index fbc3fc8..c3540bc 100644 --- a/app/src/modules/st_common.py +++ b/app/src/modules/st_common.py @@ -436,11 +436,9 @@ def create_zip(state_dict_filt, provider): # Check if the conf is full ollama or openai, currently supported for springai export def check_hybrid_conf(session_state_json): - embedding_models = meta.embedding_models() - chat_models = meta.ll_models() - - embModel = embedding_models.get(session_state_json["rag_params"].get("model")) - chatModel = chat_models.get(session_state_json["ll_model"]) + chatModel = state.ll_model_config.get(session_state_json["ll_model"]) + embModel = state.embed_model_config.get(state.rag_params["model"]) + logger.info("Model: %s",session_state_json["ll_model"]) logger.info("Embedding Model embModel: %s",embModel) logger.info("Chat Model: %s",chatModel) From 00d6bdb8b768b3c330586c60991a3ddc6508fc68 Mon Sep 17 00:00:00 2001 From: corradodebari Date: Mon, 18 Nov 2024 14:56:33 +0100 Subject: [PATCH 2/2] check embed model fails at startup --- .gitignore | 4 ++++ app/src/modules/st_common.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6fbdeca..adc6f37 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,7 @@ spring_ai/create_user.sql spring_ai/drop.sql start.sh spring_ai/env.sh +temp/rag_agent.ipynb +temp/tools.ipynb +temp/tools.py +temp/json-dual.sql diff --git a/app/src/modules/st_common.py b/app/src/modules/st_common.py index c3540bc..b668043 100644 --- a/app/src/modules/st_common.py +++ b/app/src/modules/st_common.py @@ -437,8 +437,13 @@ def create_zip(state_dict_filt, provider): def check_hybrid_conf(session_state_json): chatModel = state.ll_model_config.get(session_state_json["ll_model"]) - embModel = state.embed_model_config.get(state.rag_params["model"]) + if "rag_params" in state and "model" in state.rag_params: + embModel = state.embed_model_config.get(state.rag_params["model"]) + else: + # Handle the case where rag_params or "model" key does not exist + embModel = None # or some default value + logger.info("Model: %s",session_state_json["ll_model"]) logger.info("Embedding Model embModel: %s",embModel) logger.info("Chat Model: %s",chatModel)