remove lite_llm; distinguish if first message or whole conversation in chat querifier; Add info to README
This commit is contained in:
parent
889816a9a5
commit
49796a4657
2 changed files with 11 additions and 5 deletions
3
.env
3
.env
|
|
@ -42,6 +42,5 @@ LLM_API_KEY=placeholder
|
||||||
# valid Language options - "en" "de" "multi"
|
# valid Language options - "en" "de" "multi"
|
||||||
LLM_LANGUAGE=de
|
LLM_LANGUAGE=de
|
||||||
|
|
||||||
# LLM Model to be used - "mistral", "phi3", "llama3", etc.
|
# LLM Model to be used - "mistral", "phi3", "llama3", etc. (Check available with <ip_of_ollama_instance>:11434/api/tags)
|
||||||
LLM_MODEL_NAME=mistral
|
LLM_MODEL_NAME=mistral
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ SEARCH_COMPONENT = IndexSearchComponent(os_client=OS_INTERFACE)
|
||||||
PROMPTS = LLM.prompt_obj
|
PROMPTS = LLM.prompt_obj
|
||||||
llm_component_name = "ollama-llm"
|
llm_component_name = "ollama-llm"
|
||||||
selected_language = "german"
|
selected_language = "german"
|
||||||
lite_llm = os.getenv("LITE_LLM")
|
|
||||||
stream_llms = ["fu"]
|
stream_llms = ["fu"]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -97,7 +96,15 @@ def chat(stream_response, messages, tags=None, languages: str = None, start_date
|
||||||
raise HTTPException(status_code=400, detail="Invalid format for 'messages'")
|
raise HTTPException(status_code=400, detail="Invalid format for 'messages'")
|
||||||
|
|
||||||
# provides you a query based on the whole chat
|
# provides you a query based on the whole chat
|
||||||
query = LLM.llm_chat_querifier(chat=messages)
|
if len(messages) <= 2:
|
||||||
|
if messages[0]["role"] == "user":
|
||||||
|
query = messages[0]["content"]
|
||||||
|
elif messages[1]["role"] == "user":
|
||||||
|
query = messages[1]["content"]
|
||||||
|
else:
|
||||||
|
query = LLM.llm_chat_querifier(chat=messages)
|
||||||
|
else:
|
||||||
|
query = LLM.llm_chat_querifier(chat=messages)
|
||||||
logger.info("Generated query: '%s'", query)
|
logger.info("Generated query: '%s'", query)
|
||||||
|
|
||||||
# creating a new dashboard logger at the start of the project
|
# creating a new dashboard logger at the start of the project
|
||||||
|
|
@ -137,7 +144,7 @@ def chat(stream_response, messages, tags=None, languages: str = None, start_date
|
||||||
# check if chat is allowed for selected llm
|
# check if chat is allowed for selected llm
|
||||||
logger.info("Stream response: %s", stream_response)
|
logger.info("Stream response: %s", stream_response)
|
||||||
if stream_response == "true":
|
if stream_response == "true":
|
||||||
if lite_llm == "true" or llm_component_name in stream_llms:
|
if llm_component_name in stream_llms:
|
||||||
answer = LLM.llm_chat_request(
|
answer = LLM.llm_chat_request(
|
||||||
chat=messages,
|
chat=messages,
|
||||||
context=formatted_context,
|
context=formatted_context,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue