aysemutluay commited on
Commit
696fbdd
·
verified ·
1 Parent(s): 20a12a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -112,8 +112,13 @@ def answer_question(question, chat_history):
112
 
113
  print(f"Gelen soru: {question}")
114
 
115
- retrieved_docs = vector_db.similarity_search(question, k=2)
116
- context = "\n\n".join([doc.page_content for doc in retrieved_docs])
 
 
 
 
 
117
 
118
  print(f"Bağlam için {len(retrieved_docs)} belge bulundu. İlk 200 karakter:\n{context[:200]}...")
119
 
 
112
 
113
  print(f"Gelen soru: {question}")
114
 
115
+ retrieved_docs = vector_db.similarity_search(question, k=2)
116
+ context = "\n\n".join([doc.page_content for doc in retrieved_docs])
117
+
118
+ # GPT2 modelinin token sınırını aşmamak için bağlamı kısalt
119
+ if len(context) > 1500:
120
+ context = context[:1500]
121
+
122
 
123
  print(f"Bağlam için {len(retrieved_docs)} belge bulundu. İlk 200 karakter:\n{context[:200]}...")
124