Skip to content

Commit

Permalink
Fix for using azure deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
itisallgood committed Oct 9, 2024
1 parent 93dd488 commit 481899f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions holmes/core/tool_calling_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ def _strip_model_prefix(self) -> str:
https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json
"""
model_name = self.model
if "azure" in model_name and model_name not in litellm.model_cost:
if not os.getenv("AZURE_MODEL_TYPE"):
response = litellm.completion(
model = self.model,
messages = [{ "content": "","role": "user"}],
base_url=os.getenv("AZURE_API_BASE")
)
os.environ['AZURE_MODEL_TYPE'] = response.model
logging.info(f"Detected azure model {response.model}")
return response.model

return os.environ['AZURE_MODEL_TYPE']
if model_name.startswith('openai/'):
model_name = model_name[len('openai/'):] # Strip the 'openai/' prefix
return model_name
Expand Down

0 comments on commit 481899f

Please sign in to comment.