Spaces:
Build error
Build error
Ilia Tambovtsev commited on
Commit ·
c490faa
1
Parent(s): a631c8a
fix: handle case when vision_prompt is provided but set to None
Browse files- src/pdf_utils/chains.py +5 -0
src/pdf_utils/chains.py
CHANGED
|
@@ -162,6 +162,11 @@ class VisionAnalysisChain(Chain):
|
|
| 162 |
"""
|
| 163 |
# Use custom prompt if provided, otherwise fall back to default
|
| 164 |
current_prompt = inputs.get("vision_prompt", self._prompt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
return self._chain.invoke({
|
| 166 |
"prompt": current_prompt,
|
| 167 |
"image": inputs["image"]
|
|
|
|
| 162 |
"""
|
| 163 |
# Use custom prompt if provided, otherwise fall back to default
|
| 164 |
current_prompt = inputs.get("vision_prompt", self._prompt)
|
| 165 |
+
|
| 166 |
+
# In case there is key "vision_prompt" set to None
|
| 167 |
+
if current_prompt is None:
|
| 168 |
+
current_prompt = self._prompt
|
| 169 |
+
|
| 170 |
return self._chain.invoke({
|
| 171 |
"prompt": current_prompt,
|
| 172 |
"image": inputs["image"]
|