Originally created by @Ashbajawed on GitHub (Feb 24, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/10688
how can we get citations via end point API using python
def chat_with_collection(token, model, query, collection_id): url = f'{main_url}/api/chat/completions' headers = { 'Authorization': f'Bearer {token}', 'Content-Type': 'application/json' } payload = { 'model': model,
"messages": [ { "role": "user", "content": prompt, "sources": True, }, {"role": "user", "content": query,"sources": True, }, ], 'files': [{'type': 'file', 'id': collection_id}], 'params': {'top_k': 30, 'top_p': 0.9, 'min_p': 0, 'repeat_last_n': 64}, }
response = requests.post( url = f'{main_url}/api/chat/completions', headers=headers, data=json.dumps(payload), verify=False, stream=True, ) return response
No dependencies set.
The note is not visible to the blocked user.
Originally created by @Ashbajawed on GitHub (Feb 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/10688
how can we get citations via end point API using python
def chat_with_collection(token, model, query, collection_id):
url = f'{main_url}/api/chat/completions'
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
payload = {
'model': model,
response = requests.post(
url = f'{main_url}/api/chat/completions',
headers=headers, data=json.dumps(payload), verify=False, stream=True,
)
return response