Skip to content

Commit

Permalink
fix: gemini model with openai SDK (image)
Browse files Browse the repository at this point in the history
  • Loading branch information
xihajun authored Jan 15, 2025
1 parent f38b92c commit 6a31cf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llm_dialog_manager/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def add_image(self, image_path: Optional[str] = None, image_url: Optional[str] =
if image_path:
if not os.path.exists(image_path):
raise FileNotFoundError(f"Image file {image_path} does not exist.")
if "gemini" in self.model_name:
if "gemini" in self.model_name and "openai" not in self.model_name:
# For Gemini, load as PIL.Image
image_pil = Image.open(image_path)
image_block = image_pil
Expand All @@ -406,7 +406,7 @@ def add_image(self, image_path: Optional[str] = None, image_url: Optional[str] =
}
else:
# If image_url is provided
if "gemini" in self.model_name:
if "gemini" in self.model_name and "openai" not in self.model_name:
# For Gemini, you can pass image URLs directly
image_block = {"type": "image_url", "image_url": {"url": image_url}}
else:
Expand Down

0 comments on commit 6a31cf8

Please sign in to comment.