Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Answers in the question language #19

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions ai_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
chat_system_template = """
You are a friendly and talkative conversational agent, tasked with answering questions based on the context provided below delimited by triple pluses.
Use the following step-by-step instructions to respond to user inputs:
1 - If the question is in a different language than Dutch, translate the question to Dutch before answering.
1 - If the question is in a different language than English, translate the question to English before answering.
2 - The text provided in the context delimited by triple pluses is retrieved from the Alkemio platform and is not part of the conversation with the user.
3 - Provide an answer of 250 words or less that is professional, engaging, accurate and exthausive, based on the context delimited by triple pluses. \
If the answer cannot be found within the context, write 'Hmm, I am not sure'.
4 - If the question is not specifically about Alkemio or if the question is not professional write 'Unfortunately, I cannot answer that question'.
5 - Only return the answer from step 3, do not show any code or additional information.
6 - Answer in Dutch.
6 - Answer in the language of the question.
+++
{context}
+++
Expand All @@ -43,7 +43,8 @@
"""


condense_question_prompt = PromptTemplate.from_template(condense_question_template)
condense_question_prompt = PromptTemplate.from_template(
condense_question_template)

chat_prompt = ChatPromptTemplate.from_messages(
[
Expand Down Expand Up @@ -89,7 +90,8 @@ async def query_chain(message, language, history):
% (question, knowledge_space_name, context_space_name)
)

chroma_client = chromadb.HttpClient(host=config["db_host"], port=config["db_port"])
chroma_client = chromadb.HttpClient(
host=config["db_host"], port=config["db_port"])
collection = chroma_client.get_collection(
knowledge_space_name, embedding_function=embed_func
)
Expand All @@ -99,7 +101,8 @@ async def query_chain(message, language, history):
)

logger.info(docs["metadatas"])
logger.info("Documents with ids [%s] selected" % ",".join(list(docs["ids"][0])))
logger.info("Documents with ids [%s] selected" %
",".join(list(docs["ids"][0])))

review_system_prompt = SystemMessagePromptTemplate(
prompt=PromptTemplate(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "virtual-contributor-engine-expert"
version = "0.2.0"
version = "0.3.3"
description = "Alkemio Generative AI Virtul Persona"
authors = ["Alkemio BV <[email protected]>"]
license = "EUPL-1.2"
Expand Down