Update app.py
Browse files
app.py
CHANGED
|
@@ -156,13 +156,8 @@ class SimpleAgent:
|
|
| 156 |
# Check if the question mentions an attached file
|
| 157 |
has_attachment = "Attached file available at:" in question
|
| 158 |
|
| 159 |
-
|
| 160 |
-
# Don't use the complex prompt structure that was causing issues
|
| 161 |
-
pass # We'll create the prompt in the pipeline section
|
| 162 |
-
|
| 163 |
-
logging.info(f"Sending prompt to model (first 200 chars): {prompt[:200]}...")
|
| 164 |
logging.info(f"Full question length: {len(question)} characters")
|
| 165 |
-
logging.info(f"Full prompt length: {len(prompt)} characters")
|
| 166 |
|
| 167 |
# Try different LLM approaches based on what's available
|
| 168 |
try:
|
|
@@ -174,6 +169,7 @@ class SimpleAgent:
|
|
| 174 |
|
| 175 |
# Create an even simpler, more direct prompt
|
| 176 |
simple_prompt = f"Q: {question[:200]}...\nA:"
|
|
|
|
| 177 |
|
| 178 |
outputs = self.text_generator(
|
| 179 |
simple_prompt,
|
|
@@ -221,8 +217,9 @@ class SimpleAgent:
|
|
| 221 |
else:
|
| 222 |
# InferenceClient approach
|
| 223 |
logging.info("Using InferenceClient...")
|
|
|
|
| 224 |
response = self.client.text_generation(
|
| 225 |
-
|
| 226 |
max_new_tokens=200,
|
| 227 |
temperature=0.3,
|
| 228 |
return_full_text=False
|
|
|
|
| 156 |
# Check if the question mentions an attached file
|
| 157 |
has_attachment = "Attached file available at:" in question
|
| 158 |
|
| 159 |
+
logging.info(f"Sending prompt to model (first 200 chars): Question: {question[:200]}...")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
logging.info(f"Full question length: {len(question)} characters")
|
|
|
|
| 161 |
|
| 162 |
# Try different LLM approaches based on what's available
|
| 163 |
try:
|
|
|
|
| 169 |
|
| 170 |
# Create an even simpler, more direct prompt
|
| 171 |
simple_prompt = f"Q: {question[:200]}...\nA:"
|
| 172 |
+
logging.info(f"Simple prompt length: {len(simple_prompt)} characters")
|
| 173 |
|
| 174 |
outputs = self.text_generator(
|
| 175 |
simple_prompt,
|
|
|
|
| 217 |
else:
|
| 218 |
# InferenceClient approach
|
| 219 |
logging.info("Using InferenceClient...")
|
| 220 |
+
basic_prompt = f"Question: {question}\nAnswer:"
|
| 221 |
response = self.client.text_generation(
|
| 222 |
+
basic_prompt,
|
| 223 |
max_new_tokens=200,
|
| 224 |
temperature=0.3,
|
| 225 |
return_full_text=False
|