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
For more details about how to also uploading base 64 encoded images in iOS check the [ChatVision](https://github.com/jamesrochabrun/SwiftOpenAI/tree/main/Examples/SwiftOpenAIExample/SwiftOpenAIExample/Vision) demo on the Examples section of this package.
1262
1263
1264
+
### Response
1265
+
1266
+
OpenAI's most advanced interface for generating model responses. Supports text and image inputs, and text outputs. Create stateful interactions with the model, using the output of previous responses as input. Extend the model's capabilities with built-in tools for file search, web search, computer use, and more. Allow the model access to external systems and data using function calling.
- [Extend the models with tools](https://platform.openai.com/docs/guides/tools?api-mode=responses)
1277
+
1278
+
Parameters
1279
+
```swift
1280
+
/// [Creates a model response.](https://platform.openai.com/docs/api-reference/responses/create)
1281
+
publicstruct ModelResponseParameter:Codable {
1282
+
1283
+
/// Text, image, or file inputs to the model, used to generate a response.
1284
+
/// A text input to the model, equivalent to a text input with the user role.
1285
+
/// A list of one or many input items to the model, containing different content types.
1286
+
publicvar input: InputType
1287
+
1288
+
/// Model ID used to generate the response, like gpt-4o or o1. OpenAI offers a wide range of models with
1289
+
/// different capabilities, performance characteristics, and price points.
1290
+
/// Refer to the model guide to browse and compare available models.
1291
+
publicvar model: String
1292
+
1293
+
/// Specify additional output data to include in the model response. Currently supported values are:
1294
+
/// file_search_call.results : Include the search results of the file search tool call.
1295
+
/// message.input_image.image_url : Include image urls from the input message.
1296
+
/// computer_call_output.output.image_url : Include image urls from the computer call output.
1297
+
publicvar include: [String]?
1298
+
1299
+
/// Inserts a system (or developer) message as the first item in the model's context.
1300
+
/// When using along with previous_response_id, the instructions from a previous response will be not be
1301
+
/// carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
1302
+
publicvar instructions: String?
1303
+
1304
+
/// An upper bound for the number of tokens that can be generated for a response, including visible output tokens
1305
+
/// and reasoning tokens.
1306
+
publicvar maxOutputTokens: Int?
1307
+
1308
+
/// Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information
1309
+
/// about the object in a structured format, and querying for objects via API or the dashboard.
1310
+
/// Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
1311
+
publicvar metadata: [String: String]?
1312
+
1313
+
/// Whether to allow the model to run tool calls in parallel.
1314
+
/// Defaults to true
1315
+
publicvar parallelToolCalls: Bool?
1316
+
1317
+
/// The unique ID of the previous response to the model. Use this to create multi-turn conversations.
1318
+
/// Learn more about conversation state.
1319
+
publicvar previousResponseId: String?
1320
+
1321
+
/// o-series models only
1322
+
/// Configuration options for reasoning models.
1323
+
publicvar reasoning: Reasoning?
1324
+
1325
+
/// Whether to store the generated model response for later retrieval via API.
1326
+
/// Defaults to true
1327
+
publicvar store: Bool?
1328
+
1329
+
/// If set to true, the model response data will be streamed to the client as it is generated using server-sent events.
1330
+
publicvar stream: Bool?
1331
+
1332
+
/// What sampling temperature to use, between 0 and 2.
1333
+
/// Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
1334
+
/// We generally recommend altering this or top_p but not both.
1335
+
/// Defaults to 1
1336
+
publicvar temperature: Double?
1337
+
1338
+
/// Configuration options for a text response from the model. Can be plain text or structured JSON data.
1339
+
publicvar text: TextConfiguration?
1340
+
1341
+
/// How the model should select which tool (or tools) to use when generating a response.
1342
+
/// See the tools parameter to see how to specify which tools the model can call.
1343
+
publicvar toolChoice: ToolChoiceMode?
1344
+
1345
+
/// An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter.
1346
+
publicvar tools: [Tool]?
1347
+
1348
+
/// An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
1349
+
/// So 0.1 means only the tokens comprising the top 10% probability mass are considered.
1350
+
/// We generally recommend altering this or temperature but not both.
1351
+
/// Defaults to 1
1352
+
publicvar topP: Double?
1353
+
1354
+
/// The truncation strategy to use for the model response.
1355
+
/// Defaults to disabled
1356
+
publicvar truncation: String?
1357
+
1358
+
/// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
/// OpenAI's most advanced interface for generating model responses. Supports text and image inputs, and text outputs. Create stateful interactions with the model, using the output of previous responses as input. Extend the model's capabilities with built-in tools for file search, web search, computer use, and more. Allow the model access to external systems and data using function calling.
33
+
case response(ResponseCategory) // https://platform.openai.com/docs/api-reference/responses
34
+
32
35
enumAssistantCategory{
33
36
case create
34
37
case list
@@ -82,6 +85,11 @@ enum AzureOpenAIAPI {
82
85
case retrieve(vectorStoreID:String, fileID:String)
0 commit comments