From 4c63cbf5b1385e0203ba94befaac9c1e92647df3 Mon Sep 17 00:00:00 2001 From: takatost Date: Fri, 20 Oct 2023 15:27:46 +0800 Subject: [PATCH] feat: adjust anthropic (#1387) --- api/core/model_providers/providers/anthropic_provider.py | 2 +- api/core/model_providers/providers/azure_openai_provider.py | 2 +- api/core/model_providers/providers/hosted.py | 6 +++--- api/core/model_providers/providers/openai_provider.py | 2 +- api/core/model_providers/rules/anthropic.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/core/model_providers/providers/anthropic_provider.py b/api/core/model_providers/providers/anthropic_provider.py index eab61c60ccc2f0..2f667aed965732 100644 --- a/api/core/model_providers/providers/anthropic_provider.py +++ b/api/core/model_providers/providers/anthropic_provider.py @@ -172,7 +172,7 @@ def is_provider_type_system_supported(cls) -> bool: def should_deduct_quota(self): if hosted_model_providers.anthropic and \ - hosted_model_providers.anthropic.quota_limit and hosted_model_providers.anthropic.quota_limit > 0: + hosted_model_providers.anthropic.quota_limit and hosted_model_providers.anthropic.quota_limit > -1: return True return False diff --git a/api/core/model_providers/providers/azure_openai_provider.py b/api/core/model_providers/providers/azure_openai_provider.py index a34b463286a76a..242d9109cf28b2 100644 --- a/api/core/model_providers/providers/azure_openai_provider.py +++ b/api/core/model_providers/providers/azure_openai_provider.py @@ -329,7 +329,7 @@ def is_provider_type_system_supported(cls) -> bool: def should_deduct_quota(self): if hosted_model_providers.azure_openai \ - and hosted_model_providers.azure_openai.quota_limit and hosted_model_providers.azure_openai.quota_limit > 0: + and hosted_model_providers.azure_openai.quota_limit and hosted_model_providers.azure_openai.quota_limit > -1: return True return False diff --git a/api/core/model_providers/providers/hosted.py b/api/core/model_providers/providers/hosted.py index d2dc39b73f15c5..fd90a0a360cfe6 100644 --- a/api/core/model_providers/providers/hosted.py +++ b/api/core/model_providers/providers/hosted.py @@ -11,7 +11,7 @@ class HostedOpenAI(BaseModel): api_organization: str = None api_key: str quota_limit: int = 0 - """Quota limit for the openai hosted model. 0 means unlimited.""" + """Quota limit for the openai hosted model. -1 means unlimited.""" paid_enabled: bool = False paid_stripe_price_id: str = None paid_increase_quota: int = 1 @@ -21,14 +21,14 @@ class HostedAzureOpenAI(BaseModel): api_base: str api_key: str quota_limit: int = 0 - """Quota limit for the azure openai hosted model. 0 means unlimited.""" + """Quota limit for the azure openai hosted model. -1 means unlimited.""" class HostedAnthropic(BaseModel): api_base: str = None api_key: str quota_limit: int = 0 - """Quota limit for the anthropic hosted model. 0 means unlimited.""" + """Quota limit for the anthropic hosted model. -1 means unlimited.""" paid_enabled: bool = False paid_stripe_price_id: str = None paid_increase_quota: int = 1000000 diff --git a/api/core/model_providers/providers/openai_provider.py b/api/core/model_providers/providers/openai_provider.py index d72ad3c03bc18d..e2e17eab4570f3 100644 --- a/api/core/model_providers/providers/openai_provider.py +++ b/api/core/model_providers/providers/openai_provider.py @@ -250,7 +250,7 @@ def is_provider_type_system_supported(cls) -> bool: def should_deduct_quota(self): if hosted_model_providers.openai \ - and hosted_model_providers.openai.quota_limit and hosted_model_providers.openai.quota_limit > 0: + and hosted_model_providers.openai.quota_limit and hosted_model_providers.openai.quota_limit > -1: return True return False diff --git a/api/core/model_providers/rules/anthropic.json b/api/core/model_providers/rules/anthropic.json index c0aac8617c05d7..e617842b94d9c0 100644 --- a/api/core/model_providers/rules/anthropic.json +++ b/api/core/model_providers/rules/anthropic.json @@ -9,7 +9,7 @@ "trial" ], "quota_unit": "tokens", - "quota_limit": 600000 + "quota_limit": 0 }, "model_flexibility": "fixed", "price_config": {