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
Copy file name to clipboardExpand all lines: doc/functions/openAIChat.md
+21-15Lines changed: 21 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Connect to OpenAI™ Chat Completion API
19
19
20
20
## Description
21
21
22
-
Connect to the OpenAI™ Chat Completion API to generate text using large language models developed by OpenAI.
22
+
Connect to the OpenAI Chat Completion API to generate text using large language models developed by OpenAI.
23
23
24
24
25
25
To connect to the OpenAI API, you need a valid API key. For information on how to obtain an API key, see [https://platform.openai.com/docs/quickstart](https://platform.openai.com/docs/quickstart).
@@ -56,7 +56,7 @@ character vector | string scalar
56
56
OpenAI API key to access OpenAI APIs such as ChatGPT.
57
57
58
58
59
-
Instead of using the `APIKey` name\-value argument, you can also set the environment variable OPEN\_API\_KEY. For more information, see [https://github.com/matlab\-deep\-learning/llms\-with\-matlab/blob/main/doc/OpenAI.md](https://github.com/matlab-deep-learning/llms-with-matlab/blob/main/doc/OpenAI.md).
59
+
Instead of using the `APIKey` name\-value argument, you can also set the environment variable OPEN\_API\_KEY. For more information, see [OpenAI API](../OpenAI.md).
60
60
61
61
### `ModelName`\- Model name
62
62
@@ -66,7 +66,7 @@ Instead of using the `APIKey` name\-value argument, you can also set the environ
66
66
Name of the OpenAI model to use for text or image generation.
67
67
68
68
69
-
For a list of currently supported models, see [https://github.com/matlab\-deep\-learning/llms\-with\-matlab/blob/main/doc/OpenAI.md](https://github.com/matlab-deep-learning/llms-with-matlab/blob/main/doc/OpenAI.md).
69
+
For a list of currently supported models, see [OpenAI API](../OpenAI.md).
70
70
71
71
### `Temperature`\- Temperature
72
72
@@ -152,7 +152,7 @@ If you set the response format to `"json"`, then the generated output is a JSON
152
152
-`ModelName="gpt-4"`
153
153
-`ModelName="gpt-4-0613"`
154
154
155
-
To configure the format of the generated JSON file, describe the format using natural language and provide it to the model either in the system prompt or as a user message. For an example, see [Analyze Sentiment in Text Using ChatGPT in JSON Mode](https://github.com/matlab-deep-learning/llms-with-matlab/blob/main/examples/AnalyzeSentimentinTextUsingChatGPTinJSONMode.md).
155
+
To configure the format of the generated JSON file, describe the format using natural language and provide it to the model either in the system prompt or as a user message. For an example, see [Analyze Sentiment in Text Using ChatGPT in JSON Mode](../../examples/AnalyzeSentimentinTextUsingChatGPTinJSONMode.md).
156
156
157
157
# Properties
158
158
### `SystemPrompt`\- System prompt
@@ -176,7 +176,7 @@ The system prompt is a natural\-language description that provides the framework
176
176
Name of the OpenAI model to use for text or image generation.
177
177
178
178
179
-
For a list of currently supported models, see [https://github.com/matlab\-deep\-learning/llms\-with\-matlab/blob/main/doc/OpenAI.md](https://github.com/matlab-deep-learning/llms-with-matlab/blob/main/doc/OpenAI.md).
179
+
For a list of currently supported models, see [OpenAI API](../OpenAI.md).
180
180
181
181
### `Temperature`\- Temperature
182
182
@@ -190,7 +190,7 @@ Temperature value for controlling the randomness of the output. Higher temperatu
190
190
`1` (default) | numeric scalar between `0` and `1`
191
191
192
192
193
-
Top probability mass for controlling the diversity of the generated output. Higher top probability mass corresponds to higher diversity.
193
+
Top probability mass for controlling the diversity of the generated output using top-p sampling. Higher top probability mass corresponds to higher diversity.
194
194
195
195
### `StopSequences`\- Stop sequences
196
196
@@ -246,13 +246,20 @@ Format of generated output.
246
246
If the response format is `"text"`, then the generated output is a string.
247
247
248
248
249
-
If the response format is `"json"`, then the generated output is a JSON (\*.json) file. This option is not supported for these models:
249
+
If the response format is `"json"`, then the generated output is a string containing JSON encoded data.
250
+
251
+
252
+
To configure the format of the generated JSON file, describe the format using natural language and provide it to the model either in the system prompt or as a user message. The prompt or message describing the format must contain the word `"json"` or `"JSON"`.
253
+
254
+
255
+
For an example, see [Analyze Sentiment in Text Using ChatGPT in JSON Mode](../../examples/AnalyzeSentimentinTextUsingChatGPTinJSONMode.md).
256
+
257
+
258
+
The JSON response format is not supported for these models:
250
259
251
260
-`ModelName="gpt-4"`
252
261
-`ModelName="gpt-4-0613"`
253
262
254
-
To configure the format of the generated JSON file, describe the format using natural language and provide it to the model either in the system prompt or as a user message. For an example, see [Analyze Sentiment in Text Using ChatGPT in JSON Mode](https://github.com/matlab-deep-learning/llms-with-matlab/blob/main/examples/AnalyzeSentimentinTextUsingChatGPTinJSONMode.md).
255
-
256
263
### `FunctionNames`\- Names of OpenAI functions to use during output generation
-[Process Generated Text in Real Time Using ChatGPT in Streaming Mode](https://github.com/matlab-deep-learning/llms-with-matlab/blob/main/examples/ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode.md)
285
-
-[Analyze Scientific Papers Using Function Calls](https://github.com/matlab-deep-learning/llms-with-matlab/blob/main/examples/AnalyzeScientificPapersUsingFunctionCalls.md)
286
-
-[Analyze Sentiment in Text Using ChatGPT in JSON Mode](https://github.com/matlab-deep-learning/llms-with-matlab/blob/main/examples/AnalyzeSentimentinTextUsingChatGPTinJSONMode.md)
0 commit comments