From 2897e5e514f0e05249915c26dc78a2122ba6d50d Mon Sep 17 00:00:00 2001 From: csgulati09 Date: Wed, 25 Sep 2024 16:45:18 +0530 Subject: [PATCH] feat: anthropic mistral azure headers added --- portkey_ai/api_resources/base_client.py | 18 +++++++++++++++++ portkey_ai/api_resources/client.py | 26 +++++++++++++++++++++++++ portkey_ai/api_resources/utils.py | 3 +++ 3 files changed, 47 insertions(+) diff --git a/portkey_ai/api_resources/base_client.py b/portkey_ai/api_resources/base_client.py index 4f3e308..cbcd6b9 100644 --- a/portkey_ai/api_resources/base_client.py +++ b/portkey_ai/api_resources/base_client.py @@ -72,11 +72,14 @@ def __init__( azure_resource_name: Optional[str] = None, azure_deployment_id: Optional[str] = None, azure_api_version: Optional[str] = None, + azure_endpoint_name: Optional[str] = None, huggingface_base_url: Optional[str] = None, http_client: Optional[httpx.Client] = None, request_timeout: Optional[int] = None, strict_open_ai_compliance: Optional[bool] = None, anthropic_beta: Optional[str] = None, + anthropic_version: Optional[str] = None, + mistral_fim_completion: Optional[str] = None, **kwargs, ) -> None: self.api_key = api_key or default_api_key() @@ -102,11 +105,14 @@ def __init__( self.azure_resource_name = azure_resource_name self.azure_deployment_id = azure_deployment_id self.azure_api_version = azure_api_version + self.azure_endpoint_name = azure_endpoint_name self.huggingface_base_url = huggingface_base_url self.cache_namespace = cache_namespace self.request_timeout = request_timeout self.strict_open_ai_compliance = strict_open_ai_compliance self.anthropic_beta = anthropic_beta + self.anthropic_version = anthropic_version + self.mistral_fim_completion = mistral_fim_completion self.kwargs = kwargs self.custom_headers = createHeaders( @@ -132,11 +138,14 @@ def __init__( azure_resource_name=azure_resource_name, azure_deployment_id=azure_deployment_id, azure_api_version=azure_api_version, + azure_endpoint_name=azure_endpoint_name, huggingface_base_url=huggingface_base_url, cache_namespace=cache_namespace, request_timeout=request_timeout, strict_open_ai_compliance=strict_open_ai_compliance, anthropic_beta=anthropic_beta, + anthropic_version=anthropic_version, + mistral_fim_completion=mistral_fim_completion, **kwargs, ) @@ -565,11 +574,14 @@ def __init__( azure_resource_name: Optional[str] = None, azure_deployment_id: Optional[str] = None, azure_api_version: Optional[str] = None, + azure_endpoint_name: Optional[str] = None, huggingface_base_url: Optional[str] = None, http_client: Optional[httpx.AsyncClient] = None, request_timeout: Optional[int] = None, strict_open_ai_compliance: Optional[bool] = None, anthropic_beta: Optional[str] = None, + anthropic_version: Optional[str] = None, + mistral_fim_completion: Optional[str] = None, **kwargs, ) -> None: self.api_key = api_key or default_api_key() @@ -595,11 +607,14 @@ def __init__( self.azure_resource_name = azure_resource_name self.azure_deployment_id = azure_deployment_id self.azure_api_version = azure_api_version + self.azure_endpoint_name = azure_endpoint_name self.huggingface_base_url = huggingface_base_url self.cache_namespace = cache_namespace self.request_timeout = request_timeout self.strict_open_ai_compliance = strict_open_ai_compliance self.anthropic_beta = anthropic_beta + self.anthropic_version = anthropic_version + self.mistral_fim_completion = mistral_fim_completion self.kwargs = kwargs self.custom_headers = createHeaders( @@ -625,11 +640,14 @@ def __init__( azure_resource_name=azure_resource_name, azure_deployment_id=azure_deployment_id, azure_api_version=azure_api_version, + azure_endpoint_name=azure_endpoint_name, huggingface_base_url=huggingface_base_url, cache_namespace=cache_namespace, request_timeout=request_timeout, strict_open_ai_compliance=strict_open_ai_compliance, anthropic_beta=anthropic_beta, + anthropic_version=anthropic_version, + mistral_fim_completion=mistral_fim_completion, **kwargs, ) diff --git a/portkey_ai/api_resources/client.py b/portkey_ai/api_resources/client.py index fd72ce7..d225bc3 100644 --- a/portkey_ai/api_resources/client.py +++ b/portkey_ai/api_resources/client.py @@ -67,11 +67,14 @@ def __init__( azure_resource_name: Optional[str] = None, azure_deployment_id: Optional[str] = None, azure_api_version: Optional[str] = None, + azure_endpoint_name: Optional[str] = None, huggingface_base_url: Optional[str] = None, http_client: Optional[httpx.Client] = None, request_timeout: Optional[int] = None, strict_open_ai_compliance: Optional[bool] = None, anthropic_beta: Optional[str] = None, + anthropic_version: Optional[str] = None, + mistral_fim_completion: Optional[str] = None, **kwargs, ) -> None: super().__init__( @@ -98,12 +101,15 @@ def __init__( azure_resource_name=azure_resource_name, azure_deployment_id=azure_deployment_id, azure_api_version=azure_api_version, + azure_endpoint_name=azure_endpoint_name, huggingface_base_url=huggingface_base_url, cache_namespace=cache_namespace, http_client=http_client, request_timeout=request_timeout, strict_open_ai_compliance=strict_open_ai_compliance, anthropic_beta=anthropic_beta, + anthropic_version=anthropic_version, + mistral_fim_completion=mistral_fim_completion, **kwargs, ) @@ -158,11 +164,14 @@ def copy( azure_resource_name: Optional[str] = None, azure_deployment_id: Optional[str] = None, azure_api_version: Optional[str] = None, + azure_endpoint_name: Optional[str] = None, huggingface_base_url: Optional[str] = None, http_client: Optional[httpx.Client] = None, request_timeout: Optional[int] = None, strict_open_ai_compliance: Optional[bool] = None, anthropic_beta: Optional[str] = None, + anthropic_version: Optional[str] = None, + mistral_fim_completion: Optional[str] = None, **kwargs, ) -> Portkey: return self.__class__( @@ -189,6 +198,7 @@ def copy( azure_resource_name=azure_resource_name or self.azure_resource_name, azure_deployment_id=azure_deployment_id or self.azure_deployment_id, azure_api_version=azure_api_version or self.azure_api_version, + azure_endpoint_name=azure_endpoint_name or self.azure_endpoint_name, huggingface_base_url=huggingface_base_url or self.huggingface_base_url, cache_namespace=cache_namespace or self.cache_namespace, http_client=http_client or self._client, @@ -196,6 +206,9 @@ def copy( strict_open_ai_compliance=strict_open_ai_compliance or self.strict_open_ai_compliance, anthropic_beta=anthropic_beta or self.anthropic_beta, + anthropic_version=anthropic_version or self.anthropic_version, + mistral_fim_completion=mistral_fim_completion + or self.mistral_fim_completion, **self.kwargs, **kwargs, ) @@ -261,11 +274,14 @@ def __init__( azure_resource_name: Optional[str] = None, azure_deployment_id: Optional[str] = None, azure_api_version: Optional[str] = None, + azure_endpoint_name: Optional[str] = None, huggingface_base_url: Optional[str] = None, http_client: Optional[httpx.AsyncClient] = None, request_timeout: Optional[int] = None, strict_open_ai_compliance: Optional[bool] = None, anthropic_beta: Optional[str] = None, + anthropic_version: Optional[str] = None, + mistral_fim_completion: Optional[str] = None, **kwargs, ) -> None: super().__init__( @@ -292,12 +308,15 @@ def __init__( azure_resource_name=azure_resource_name, azure_deployment_id=azure_deployment_id, azure_api_version=azure_api_version, + azure_endpoint_name=azure_endpoint_name, huggingface_base_url=huggingface_base_url, cache_namespace=cache_namespace, http_client=http_client, request_timeout=request_timeout, strict_open_ai_compliance=strict_open_ai_compliance, anthropic_beta=anthropic_beta, + anthropic_version=anthropic_version, + mistral_fim_completion=mistral_fim_completion, **kwargs, ) @@ -352,11 +371,14 @@ def copy( azure_resource_name: Optional[str] = None, azure_deployment_id: Optional[str] = None, azure_api_version: Optional[str] = None, + azure_endpoint_name: Optional[str] = None, huggingface_base_url: Optional[str] = None, http_client: Optional[httpx.AsyncClient] = None, request_timeout: Optional[int] = None, strict_open_ai_compliance: Optional[bool] = None, anthropic_beta: Optional[str] = None, + anthropic_version: Optional[str] = None, + mistral_fim_completion: Optional[str] = None, **kwargs, ) -> AsyncPortkey: return self.__class__( @@ -383,6 +405,7 @@ def copy( azure_resource_name=azure_resource_name or self.azure_resource_name, azure_deployment_id=azure_deployment_id or self.azure_deployment_id, azure_api_version=azure_api_version or self.azure_api_version, + azure_endpoint_name=azure_endpoint_name or self.azure_endpoint_name, huggingface_base_url=huggingface_base_url or self.huggingface_base_url, cache_namespace=cache_namespace or self.cache_namespace, http_client=http_client or self._client, @@ -390,6 +413,9 @@ def copy( strict_open_ai_compliance=strict_open_ai_compliance or self.strict_open_ai_compliance, anthropic_beta=anthropic_beta or self.anthropic_beta, + anthropic_version=anthropic_version or self.anthropic_version, + mistral_fim_completion=mistral_fim_completion + or self.mistral_fim_completion, **self.kwargs, **kwargs, ) diff --git a/portkey_ai/api_resources/utils.py b/portkey_ai/api_resources/utils.py index af419da..63cc5ee 100644 --- a/portkey_ai/api_resources/utils.py +++ b/portkey_ai/api_resources/utils.py @@ -265,10 +265,13 @@ class Constructs(BaseModel): azure_resource_name: Optional[str] = None azure_deployment_id: Optional[str] = None azure_api_version: Optional[str] = None + azure_endpoint_name: Optional[str] = None huggingface_base_url: Optional[str] = None cache_namespace: Optional[str] = None request_timeout: Optional[int] = None anthropic_beta: Optional[str] = None + anthropic_version: Optional[str] = None + mistral_fim_completion: Optional[bool] = None class LLMOptions(Constructs, ConversationInput, ModelParams):