Skip to content

Commit

Permalink
check whether the model supports vision
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartManoj committed Aug 15, 2024
1 parent f1bb998 commit d63f01f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions opendevin/core/message.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from enum import Enum

import litellm
from pydantic import BaseModel, Field, model_serializer
from typing_extensions import Literal

Expand Down Expand Up @@ -60,8 +61,9 @@ def serialize_model(self) -> dict:
if self.role in ['system', 'assistant']:
return {'role': self.role, 'content': self.content[0].text}

# TODO: check whether the model supports vision
if 'ollama/' in config.get_llm_config().model:
model = config.get_llm_config().model
supports_vision = litellm.supports_vision(model)
if not supports_vision:
text_contents = '\n'.join([item.text for item in self.content])
return {'role': self.role, 'content': text_contents}

Expand Down

0 comments on commit d63f01f

Please sign in to comment.