Jesselg commited on
Commit
f1ec73f
·
verified ·
1 Parent(s): 3a32be7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -29,8 +29,8 @@ def fetch_relevant_docs(user_query):
29
  {{
30
  Get {{
31
  DigiDDocument(
32
- nearText: {{ concepts: ["{user_query}"] }},
33
- limit: 3
34
  ) {{
35
  title
36
  content
@@ -45,15 +45,11 @@ def fetch_relevant_docs(user_query):
45
  data = response.json()
46
  documents = data.get("data", {}).get("Get", {}).get("DigiDDocument", [])
47
  if not documents:
48
- print(f"⚠️ Geen documenten gevonden voor de query: {user_query}")
49
  return None
50
- # Combineer de documentatie in een nette tekst
51
- combined_text = "\n\n".join(
52
- [f"**{doc['title']}**\n{doc['content']}\nBron: {doc['url']}" for doc in documents]
53
- )
54
- return combined_text
55
  else:
56
- print(f"❌ Fout bij ophalen documentatie: {response.status_code}, {response.text}")
57
  return None
58
 
59
  # **Functie om antwoord te genereren met VLAM.AI**
 
29
  {{
30
  Get {{
31
  DigiDDocument(
32
+ nearText: {{ concepts: ["{user_query}"], certainty: 0.6 }}, # Lagere drempel
33
+ limit: 5 # Meer documenten teruggeven
34
  ) {{
35
  title
36
  content
 
45
  data = response.json()
46
  documents = data.get("data", {}).get("Get", {}).get("DigiDDocument", [])
47
  if not documents:
48
+ print(f"⚠️ Geen documenten gevonden voor: {user_query}")
49
  return None
50
+ return "\n\n".join([f"{doc['content']}" for doc in documents])
 
 
 
 
51
  else:
52
+ print(f"❌ Weaviate-fout: {response.status_code}")
53
  return None
54
 
55
  # **Functie om antwoord te genereren met VLAM.AI**