File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
articles/cognitive-services/openai/how-to Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,22 @@ An embedding is a special format of data representation that can be easily utili
22
22
23
23
To obtain an embedding vector for a piece of text, we make a request to the embeddings endpoint as shown in the following code snippets:
24
24
25
+ # [ console] ( #tab/console )
25
26
``` console
26
27
curl https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings?api-version=2022-12-01\
27
28
-H 'Content-Type: application/json' \
28
29
-H 'api-key: YOUR_API_KEY' \
29
30
-d '{"input": "Sample Document goes here"}'
30
31
```
32
+ # [ python] ( #tab/python )
33
+ ``` python
34
+ response = openai.Embedding.create(
35
+ input = " Your text string goes here" ,
36
+ model = " YOUR_DEPLOYMENT_NAME"
37
+ )
38
+ embeddings = response[' data' ][0 ][' embedding' ]
39
+ ```
40
+ ---
31
41
32
42
## Best Practices
33
43
You can’t perform that action at this time.
0 commit comments