I am creating catboat using Gradio and LLM with document embeddings. I want pass document source actual link with actual answer. How can i pass link
I am using below code and tried multiple ways, still not working
def summarize(input,chat_history):
output = Reference_QA({“query”: input}) ## LLM Module call
chat_history.append((input, output[“result”]))
#chat_history=(input, output[“result”]))
sources = [doc.metadata.get(“source”) for doc in output[“source_documents”]]
#source_link=sources[0]
source_link=f"\nReference"
chat_history.append((input, output[“result”],source_link))
#chat_history.append(f"Answer: {answer}\n[Source Document]({source_link})"
# return "", chat_history
return chat_history
with gr.Blocks() as demo:
gr.Markdown(“”“
My Helper Chatboat
”“”)gr.description = Reference
chatbot = gr.Chatbot(height=240) #just to fit the notebook
#chatbot = gr.Chatbot(height=240) #just to fit the notebook
msg = gr.Textbox(label=“Prompt”)
gr.title="VOA to answer common FAQs and Queries",
msg = gr.Textbox(label="How may I help you?")
btn = gr.Button("Submit")
Link='https://example'
with gr.Accordion("Reference:",link):
gr.Markdown("Look at me...")
clear = gr.ClearButton(components=[msg, chatbot], value="Clear console")
btn.click(summarize, inputs=[msg, chatbot], outputs=[msg, chatbot])
msg.submit(summarize, inputs=[msg, chatbot], outputs=[msg, chatbot]) #Press enter to submit
gr.close_all()
demo.launch(share=True)