erste Version WP05
This commit is contained in:
1 parent
fbaa07ba88
commit
90f0be6baf
7 files changed
+320
-40
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
|
||||
# Konfiguration
|
||||
API_URL = "http://localhost:8002/chat/" # Port ggf. anpassen
|
||||
QUESTION = "Was ist das Ziel von mindnet?" # Eine Frage, zu der du Notizen hast
|
||||
|
||||
def test_chat():
|
||||
payload = {
|
||||
"message": QUESTION,
|
||||
"top_k": 3,
|
||||
"explain": True
|
||||
}
|
||||
|
||||
print(f"Sending Question: '{QUESTION}'...")
|
||||
|
||||
try:
|
||||
response = requests.post(API_URL, json=payload)
|
||||
response.raise_for_status()
|
||||
|
||||
data = response.json()
|
||||
|
||||
print("\n=== RESPONSE ===")
|
||||
print(data["answer"])
|
||||
print("================\n")
|
||||
|
||||
print(f"Query ID: {data['query_id']}")
|
||||
print(f"Latency: {data['latency_ms']}ms")
|
||||
print("\nUsed Sources:")
|
||||
for source in data["sources"]:
|
||||
score = source.get("total_score", 0)
|
||||
note = source.get("note_id", "unknown")
|
||||
print(f"- {note} (Score: {score:.3f})")
|
||||
|
||||
except requests.exceptions.ConnectionError:
|
||||
print("Error: Could not connect to API. Is it running on port 8002?")
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
if 'response' in locals():
|
||||
print(response.text)
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_chat()
|
||||
Reference in new issue
Block a user