fix: wrong role in req messages

This commit is contained in:
Siddhant Rai
2025-01-21 07:19:02 +05:30
parent d441d5763f
commit 1086bfe1ba
2 changed files with 8 additions and 8 deletions

View File

@@ -17,6 +17,9 @@ class GoogleLLM(BaseLLM):
role = message.get("role")
content = message.get("content")
if role == "assistant":
role = "model"
parts = []
if role and content is not None:
if isinstance(content, str):

View File

@@ -5,7 +5,6 @@ from application.tools.agent import Agent
from application.vectorstore.vector_creator import VectorCreator
class ClassicRAG(BaseRetriever):
def __init__(
@@ -74,13 +73,11 @@ class ClassicRAG(BaseRetriever):
if len(self.chat_history) > 1:
for i in self.chat_history:
if "prompt" in i and "response" in i:
messages_combine.append(
{"role": "user", "content": i["prompt"]}
)
messages_combine.append(
{"role": "system", "content": i["response"]}
)
if "prompt" in i and "response" in i:
messages_combine.append({"role": "user", "content": i["prompt"]})
messages_combine.append(
{"role": "assistant", "content": i["response"]}
)
messages_combine.append({"role": "user", "content": self.question})
# llm = LLMCreator.create_llm(
# settings.LLM_NAME, api_key=settings.API_KEY, user_api_key=self.user_api_key