Skip to content

Commit

Permalink
add sources to answer
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-sol committed Jul 18, 2024
1 parent 88c845c commit e951b9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 3 additions & 12 deletions scripts/gradio-ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@


def format_sources(completion) -> str:
if len(completion.source_nodes) == 0:
if len(completion.sources) == 0:
return ""

# Mapping of source system names to user-friendly names
Expand All @@ -186,7 +186,7 @@ def format_sources(completion) -> str:
),
url=src.metadata["url"],
)
for src in completion.source_nodes
for src in completion.sources[0].raw_output
]
)

Expand Down Expand Up @@ -257,19 +257,10 @@ def generate_completion(
retriever=custom_retriever,
metadata=ToolMetadata(
name="AI_information",
description="""Only use this tool if necessary. The 'AI_information' tool is a comprehensive repository for information in artificial intelligence (AI). When utilizing this tool, the input should be the user's question rewritten as a statement. The input can also be adapted to focus on specific aspects or further details of the current topic under discussion. This dynamic input approach allows for a tailored exploration of AI subjects, ensuring that responses are relevant and informative. Employ this tool to fetch nuanced information on topics such as model training, fine-tuning, and LLM augmentation, thereby facilitating a rich, context-aware dialogue. """,
description="""Only use this tool if necessary. The 'AI_information' tool is a comprehensive repository for information in artificial intelligence (AI). When using this tool, the input should be the user's question rewritten as a statement. e.g. When the user asks 'How can I fine-tune an LLM?', the input should be 'Fine-tune an Large Language Model (LLM)'. The input can also be adapted to focus on specific aspects or further details of the current topic under discussion. This dynamic input approach allows for a tailored exploration of AI subjects, ensuring that responses are relevant and informative. Employ this tool to fetch nuanced information on topics such as model training, fine-tuning, and LLM augmentation, thereby facilitating a rich, context-aware dialogue. """,
),
)
]
# query_engine_tools = [
# QueryEngineTool(
# query_engine=custom_query_engine,
# metadata=ToolMetadata(
# name="AI_information",
# description="""Only use this tool if necessary. The 'AI_information' tool is a comprehensive repository for information in artificial intelligence (AI). When utilizing this tool, the input should be the user's question rewritten as a statement. The input can also be adapted to focus on specific aspects or further details of the current topic under discussion. This dynamic input approach allows for a tailored exploration of AI subjects, ensuring that responses are relevant and informative. Employ this tool to fetch nuanced information on topics such as model training, fine-tuning, and LLM augmentation, thereby facilitating a rich, context-aware dialogue. """,
# ),
# )
# ]

if model == "gemini-1.5-flash" or model == "gemini-1.5-pro":
# agent = AgentRunner.from_llm(
Expand Down
4 changes: 3 additions & 1 deletion scripts/tutor_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ class QueryValidation(BaseModel):
Your answers are aimed to teach students, so they should be complete, clear, and easy to understand.
Utilize the AI_information tool to gather insights pertinent to the field of AI. This function accepts a string (user question rewritten as a statement) and returns informative content regarding the domain of AI.
Use the AI_information tool to gather insights pertinent to the field of AI. This function accepts a string (user question rewritten as a statement) and returns informative content regarding the domain of AI.
User question: How can I fine-tune an LLM?, input to the AI_information tool: 'Fine-tune an Large Language Model (LLM)'
Only some information returned by the tool might be relevant to the question, so ignore the irrelevant part and use the relevant part to answer the question.
Expand Down

0 comments on commit e951b9f

Please sign in to comment.