You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All endpoints have a `.create` method that supports a `request_timeout` param. This param takes a `Union[float, Tuple[float, float]]` and will raise an `openai.error.Timeout` error if the request exceeds that time in seconds (See: https://requests.readthedocs.io/en/latest/user/quickstart/#timeouts).
74
+
75
+
All endpoints have a `.create` method that supports a `request_timeout` param. This param takes a `Union[float, Tuple[float, float]]` and will raise an `openai.error.Timeout` error if the request exceeds that time in seconds (See: https://requests.readthedocs.io/en/latest/user/quickstart/#timeouts).
### Microsoft Azure Active Directory Authentication
103
104
104
105
In order to use Microsoft Active Directory to authenticate to your Azure endpoint, you need to set the `api_type` to "azure_ad" and pass the acquired credential token to `api_key`. The rest of the parameters need to be set as specified in the previous section.
openai api completions.create -m ada -p "Hello world"
139
+
139
140
# generate images via DALL·E API
140
141
openai api image.create -p "two dogs playing chess, cartoon" -n 1
141
142
@@ -147,29 +148,41 @@ openai --proxy=http://proxy.com api models.list
147
148
148
149
Examples of how to use this Python library to accomplish various tasks can be found in the [OpenAI Cookbook](https://github.com/openai/openai-cookbook/). It contains code examples for:
149
150
150
-
* Classification using fine-tuning
151
-
* Clustering
152
-
* Code search
153
-
* Customizing embeddings
154
-
* Question answering from a corpus of documents
155
-
* Recommendations
156
-
* Visualization of embeddings
157
-
* And more
151
+
- Classification using fine-tuning
152
+
- Clustering
153
+
- Code search
154
+
- Customizing embeddings
155
+
- Question answering from a corpus of documents
156
+
- Recommendations
157
+
- Visualization of embeddings
158
+
- And more
158
159
159
160
Prior to July 2022, this OpenAI Python library hosted code examples in its examples folder, but since then all examples have been migrated to the [OpenAI Cookbook](https://github.com/openai/openai-cookbook/).
160
161
161
-
### Chat
162
+
### Chat Completions
162
163
163
164
Conversational models such as `gpt-3.5-turbo` can be called using the chat completions endpoint.
164
165
165
166
```python
166
167
import openai
167
168
openai.api_key ="sk-..."# supply your API key however you choose
Text models such as `text-davinci-003`, `text-davinci-002` and earlier (`ada`, `babbage`, `curie`, `davinci`, etc.) can be called using the completions endpoint.
177
+
178
+
```python
179
+
import openai
180
+
openai.api_key ="sk-..."# supply your API key however you choose
In the OpenAI Python library, an embedding represents a text string as a fixed-length vector of floating point numbers. Embeddings are designed to measure the similarity or relevance between text strings.
0 commit comments