import os import streamlit as st import requests import qdrant_client client = qdrant_client.QdrantClient(host="localhost", port=6333, grpc_port=6334, prefer_grpc=True) client.get_collections() url = "https://api-ares.traversaal.ai/live/predict" headers = { "x-api-key": "ares_5e61d51f3abc8feb37710d8784fa49e11426ee25d7ec5236b80362832f306ed2", "content-type": "application/json" } st.title('#@ck-RAG') def inference(query): payload = { "query": [query] } response = requests.post(url, json=payload, headers=headers) # st.error(response) # st.error(response.text) response_text=response.json().get('data').get('response_text') urls=response.json().get('data').get('web_url') return response_text, urls prompt = st.text_input('Enter a query', value='') if prompt: results = client.query( collection_name="knowledge-base", query_text=prompt, limit=10, ) #results context = "Hotel Name: " + "\n".join(r.document for r in results ) #context metaprompt = f""" Based on the context provided, provide information about the Question. You can give multiple points based on the question asked or context. Question: {prompt.strip()} Context: {context.strip()} Answer: """ response_text,urls = inference(metaprompt) # Look at the full metaprompt # print(metaprompt) st.write('Query Results:') st.write(response_text) st.write('Sources:') st.write(urls)