Skip to content

Commit

Permalink
Merge pull request #1475 from mito-ds/dev
Browse files Browse the repository at this point in the history
Fix: Quota Checking Logic
  • Loading branch information
ngafar authored Jan 8, 2025
2 parents f21dff9 + 8018380 commit 3568b0d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mito-ai/mito_ai/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@ def capabilities(self) -> AICapabilities:
if self._models is None:
self._validate_api_key({"value": self.api_key})

# If the user has an OpenAI API key, then we don't need to check the Mito server quota.
if self.api_key:
return AICapabilities(
configuration={
"model": self.model,
"temperature": self.temperature,
},
provider="OpenAI (user key)",
)

# Get the number of usages
global _num_usages
if _num_usages is None:
Expand Down Expand Up @@ -216,7 +226,7 @@ def capabilities(self) -> AICapabilities:
"model": self.model,
"temperature": self.temperature,
},
provider="OpenAI (user key)" if self.api_key else "Mito server",
provider="Mito server",
)

@property
Expand Down

0 comments on commit 3568b0d

Please sign in to comment.