From 0f3d469056c19564acb83c53fa4702ad22283768 Mon Sep 17 00:00:00 2001 From: Patrick Wiltrout Date: Tue, 15 Oct 2024 00:10:25 -0400 Subject: [PATCH] removed extra spaces from api responses - combining responses with `"".join` instead of `" ".join` which fixes the markdown formatting and random word splits - added extra sentence-transformer for fun --- current/requirements.txt | 5 ++++- current/td-llm-dnd.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/current/requirements.txt b/current/requirements.txt index 4418363..0cd4b2f 100644 --- a/current/requirements.txt +++ b/current/requirements.txt @@ -3,4 +3,7 @@ requests langchain huggingface-hub sentence-transformers -python-dotenv \ No newline at end of file +python-dotenv +langchain_community +langchain_huggingface +chromadb \ No newline at end of file diff --git a/current/td-llm-dnd.py b/current/td-llm-dnd.py index bf78773..da5d85f 100644 --- a/current/td-llm-dnd.py +++ b/current/td-llm-dnd.py @@ -71,7 +71,8 @@ def api_call(model: str, prompt: str, max_tokens: int) -> str: return "Error: No valid JSON objects found in response." - combined_response = " ".join([obj.get("response", "") for obj in json_objects]) + combined_response = "".join([obj.get("response", "") for obj in json_objects]) + return combined_response except requests.RequestException as e: @@ -141,6 +142,7 @@ def manage_models(): player_model = st.selectbox("AI Player Model", models, index=models.index(st.session_state.get('player_model', models[0]))) embedding_model = st.selectbox("RAG Embedding Model", ["sentence-transformers/all-mpnet-base-v2", + "sentence-transformers/all-MiniLM-L12-v2", "sentence-transformers/all-MiniLM-L6-v2"]) if st.button("Save Model Selections"):