File tree Expand file tree Collapse file tree 1 file changed +17
-17
lines changed
articles/ai-services/openai/includes Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -39,24 +39,24 @@ pip install openai==0.28.1
39
39
# [ OpenAI Python 1.x] ( #tab/python-new )
40
40
41
41
``` python
42
- import os
43
- from openai import AzureOpenAI
42
+ import os
43
+ from openai import AzureOpenAI
44
+
45
+ client = AzureOpenAI(
46
+ api_key = os.getenv(" AZURE_OPENAI_API_KEY" ),
47
+ api_version = " 2024-02-01" ,
48
+ azure_endpoint = os.getenv(" AZURE_OPENAI_ENDPOINT" )
49
+ )
44
50
45
- client = AzureOpenAI(
46
- api_key = os.getenv(" AZURE_OPENAI_API_KEY" ),
47
- api_version = " 2024-02-01" ,
48
- azure_endpoint = os.getenv(" AZURE_OPENAI_ENDPOINT" )
49
- )
50
-
51
- deployment_id = " YOUR-DEPLOYMENT-NAME-HERE" # This will correspond to the custom name you chose for your deployment when you deployed a model."
52
- audio_test_file = " ./wikipediaOcelot.wav"
53
-
54
- result = client.audio.transcriptions.create(
55
- file = open (audio_test_file, " rb" ),
56
- model = deployment_id
57
- )
58
-
59
- print (result)
51
+ deployment_id = " YOUR-DEPLOYMENT-NAME-HERE" # This will correspond to the custom name you chose for your deployment when you deployed a model."
52
+ audio_test_file = " ./wikipediaOcelot.wav"
53
+
54
+ result = client.audio.transcriptions.create(
55
+ file = open (audio_test_file, " rb" ),
56
+ model = deployment_id
57
+ )
58
+
59
+ print (result)
60
60
```
61
61
62
62
# [ OpenAI Python 0.28.1] ( #tab/python )
You can’t perform that action at this time.
0 commit comments