@@ -36,7 +36,7 @@ from haystack.utils import Secret
3636client = AzureOpenAIGenerator(
3737 azure_endpoint = " <Your Azure endpoint e.g. `https://your-company.azure.openai.com/>" ,
3838 api_key = Secret.from_token(" <your-api-key>" ),
39- azure_deployment = " <this a model name, e.g. gpt-4o -mini>" )
39+ azure_deployment = " <this a model name, e.g. gpt-4.1 -mini>" )
4040response = client.run(" What's Natural Language Processing? Be brief." )
4141print (response)
4242```
@@ -45,7 +45,7 @@ print(response)
4545>> {'replies': ['Natural Language Processing (NLP) is a branch of artificial intelligence that focuses on
4646>> the interaction between computers and human language. It involves enabling computers to understand, interpret,
4747>> and respond to natural human language in a way that is both meaningful and useful.'], 'meta': [{'model':
48- >> 'gpt-4o -mini', 'index': 0, 'finish_reason': 'stop', 'usage': {'prompt_tokens': 16,
48+ >> 'gpt-4.1 -mini', 'index': 0, 'finish_reason': 'stop', 'usage': {'prompt_tokens': 16,
4949>> 'completion_tokens': 49, 'total_tokens': 65}}]}
5050```
5151
@@ -55,8 +55,8 @@ print(response)
5555
5656``` python
5757def __init__ (azure_endpoint : Optional[str ] = None ,
58- api_version : Optional[str ] = " 2023-05-15 " ,
59- azure_deployment : Optional[str ] = " gpt-4o -mini" ,
58+ api_version : Optional[str ] = " 2024-12-01-preview " ,
59+ azure_deployment : Optional[str ] = " gpt-4.1 -mini" ,
6060 api_key : Optional[Secret] = Secret.from_env_var(
6161 " AZURE_OPENAI_API_KEY" , strict = False ),
6262 azure_ad_token : Optional[Secret] = Secret.from_env_var(
@@ -78,7 +78,7 @@ Initialize the Azure OpenAI Generator.
7878** Arguments** :
7979
8080- ` azure_endpoint ` : The endpoint of the deployed model, for example ` https://example-resource.azure.openai.com/ ` .
81- - ` api_version ` : The version of the API to use. Defaults to 2023-05-15 .
81+ - ` api_version ` : The version of the API to use. Defaults to 2024-12-01-preview .
8282- ` azure_deployment ` : The deployment of the model, usually the model name.
8383- ` api_key ` : The API key to use for authentication.
8484- ` azure_ad_token ` : [ Azure Active Directory token] ( https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id ) .
@@ -801,7 +801,7 @@ messages = [ChatMessage.from_user("What's Natural Language Processing?")]
801801client = AzureOpenAIChatGenerator(
802802 azure_endpoint = " <Your Azure endpoint e.g. `https://your-company.azure.openai.com/>" ,
803803 api_key = Secret.from_token(" <your-api-key>" ),
804- azure_deployment = " <this a model name, e.g. gpt-4o -mini>" )
804+ azure_deployment = " <this a model name, e.g. gpt-4.1 -mini>" )
805805response = client.run(messages)
806806print (response)
807807```
@@ -812,7 +812,7 @@ print(response)
812812 " Natural Language Processing (NLP) is a branch of artificial intelligence that focuses on
813813 enabling computers to understand, interpret, and generate human language in a way that is useful." )],
814814 _name = None ,
815- _meta = {' model' : ' gpt-4o -mini' , ' index' : 0 , ' finish_reason' : ' stop' ,
815+ _meta = {' model' : ' gpt-4.1 -mini' , ' index' : 0 , ' finish_reason' : ' stop' ,
816816 ' usage' : {' prompt_tokens' : 15 , ' completion_tokens' : 36 , ' total_tokens' : 51 }})]
817817}
818818```
@@ -823,8 +823,8 @@ print(response)
823823
824824```python
825825def __init__ (azure_endpoint: Optional[str ] = None ,
826- api_version: Optional[str ] = " 2023-05-15 " ,
827- azure_deployment: Optional[str ] = " gpt-4o -mini" ,
826+ api_version: Optional[str ] = " 2024-12-01-preview " ,
827+ azure_deployment: Optional[str ] = " gpt-4.1 -mini" ,
828828 api_key: Optional[Secret] = Secret.from_env_var(
829829 " AZURE_OPENAI_API_KEY" , strict = False ),
830830 azure_ad_token: Optional[Secret] = Secret.from_env_var(
@@ -848,7 +848,7 @@ Initialize the Azure OpenAI Chat Generator component.
848848** Arguments** :
849849
850850- `azure_endpoint` : The endpoint of the deployed model, for example `" https://example-resource.azure.openai.com/" ` .
851- - `api_version` : The version of the API to use. Defaults to 2023 - 0 5 - 15 .
851+ - `api_version` : The version of the API to use. Defaults to 2024 - 12 - 0 1 - preview .
852852- `azure_deployment` : The deployment of the model, usually the model name.
853853- `api_key` : The API key to use for authentication.
854854- `azure_ad_token` : [Azure Active Directory token](https:// www.microsoft.com/ en- us/ security/ business/ identity- access/ microsoft- entra- id ).
0 commit comments