| external help file | PSOpenAI-help.xml |
|---|---|
| Module Name | PSOpenAI |
| online version | https://github.com/mkht/PSOpenAI/blob/main/Docs/Start-ThreadRun.md |
| schema | 2.0.0 |
Starts a run.
Start-ThreadRun
[-Assistant] <String>
-Message <String>
[-Images <Object[]>]
[-ImageDetail <String>]
[-Model <String>]
[-Instructions <String>]
[-ReasoningEffort <String>]
[-AdditionalMessages <Object[]>]
[-Role <String>]
[-FileIdsForCodeInterpreter <Object[]>]
[-VectorStoresForFileSearch <Object[]>]
[-MaxPromptTokens <Int32>]
[-MaxCompletionTokens <Int32>]
[-TruncationStrategyType <String>]
[-TruncationStrategyLastMessages <Int32>]
[-ToolChoice <String>]
[-ToolChoiceFunctionName <String>]
[-UseCodeInterpreter]
[-UseFileSearch]
[-Functions <IDictionary>]
[-ParallelToolCalls]
[-MetaData <IDictionary>]
[-Temperature <Double>]
[-Stream]
[-ResponseFormat <Object>]
[-JsonSchema <String>]
[-TimeoutSec <Int32>]
[-MaxRetryCount <Int32>]
[-ApiBase <Uri>]
[-ApiKey <SecureString>]
[-Organization <String>]
[-AdditionalQuery <IDictionary>]
[-AdditionalHeaders <IDictionary>]
[-AdditionalBody <Object>]
[<CommonParameters>]
Start-ThreadRun
[-ThreadId] <String>
[-Assistant] <Object>
[-Model <String>]
[-Instructions <String>]
[-ReasoningEffort <String>]
[-AdditionalInstructions <String>]
[-AdditionalMessages <Object[]>]
[-Include <String[]>]
[-MaxPromptTokens <Int32>]
[-MaxCompletionTokens <Int32>]
[-TruncationStrategyType <String>]
[-TruncationStrategyLastMessages <Int32>]
[-ToolChoice <String>]
[-ToolChoiceFunctionName <String>]
[-UseCodeInterpreter]
[-UseFileSearch]
[-Functions <IDictionary>]
[-ParallelToolCalls]
[-MetaData <IDictionary>]
[-Temperature <Double>]
[-Stream]
[-ResponseFormat <String>]
[-TimeoutSec <Int32>]
[-MaxRetryCount <Int32>]
[-ApiBase <Uri>]
[-ApiKey <SecureString>]
[-Organization <String>]
[-AdditionalQuery <IDictionary>]
[-AdditionalHeaders <IDictionary>]
[-AdditionalBody <Object>]
[<CommonParameters>]
Starts a run.
PS C:\> Start-ThreadRun -ThreadId 'thread_abc123' -Assistant 'asst_abc123'Starts a run of the thread with spcified assiatnt.
The ID of the thread to run.
Type: String
Aliases: thread_id
Required: True
Position: 0
Accept pipeline input: True (ByPropertyName, ByValue)The ID of the assistant to use to execute this run.
Type: Object
Aliases: assistant_id, AssistantId
Required: True
Position: 1
Accept pipeline input: True (ByPropertyName)The name of the Model to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
Type: String
Required: False
Position: NamedOverrides the instructions of the assistant. This is useful for modifying the behavior on a per-run basis.
Type: String
Required: False
Position: NamedConstrains effort on reasoning for reasoning models.
Supported values are none, low, medium, and high.
Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
Type: String
Aliases: reasoning_effort
Required: False
Position: NamedAppends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.
Type: String
Aliases: additional_instructions
Required: False
Position: NamedAdds additional messages to the thread before creating the run.
Type: Object[]
Aliases: additional_messages
Required: False
Position: NamedA list of additional fields to include in the response.
Type: String[]
Required: False
Position: NamedA list of file IDs made available to the code_interpreter tool. There can be a maximum of 20 files associated with the tool.
Type: Object[]
Required: False
Position: NamedThe vector store attached to this thread. There can be a maximum of 1 vector store attached to the thread.
Type: Object[]
Required: False
Position: NamedA list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
Type: Object[]
Required: False
Position: NamedSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format.
Type: IDictionary
Required: False
Position: NamedWhat sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
Type: Double
Required: False
Position: NamedA list of functions the model may call. Use this to provide a list of functions the model may generate JSON inputs for.
Type: IDictionary[]
Required: False
Position: NamedWhether to enable parallel function calling during tool use. The default is true (enabled)
Type: SwitchParameter
Aliases: parallel_tool_calls
Required: False
Position: Named
Default value: TrueOverride whether the code interpreter tool enable or not.
Type: SwitchParameter
Required: False
Position: NamedOverride whether the file_search tool enable or not.
Type: SwitchParameter
Required: False
Position: NamedIf set, partial message deltas will be sent, like in ChatGPT.
Type: SwitchParameter
Required: False
Position: Named
Default value: FalseSpecifies the format that the model must output.
defaultwill only outputs text message.json_objectenables JSON mode, which ensures the message the model generates is valid JSON.json_schemaenables Structured Outputs which ensures the model will match your supplied JSON schema.raw_responsereturns raw response content from API.
Type: Object
Aliases: response_format
Required: False
Position: NamedSpecifies an object or data structure to represent the JSON Schema that the model should be constrained to follow.
Required if json_schema is specified for -ResponseFormat. Otherwise, it is ignored.
Type: String
Required: False
Position: NamedSpecifies how long the request can be pending before it times out. The default value is 0 (infinite).
Type: Int32
Required: False
Position: Named
Default value: 0Number between 0 and 100. Specifies the maximum number of retries if the request fails. The default value is 0 (No retry).
Note : Retries will only be performed if the request fails with a 429 (Rate limit reached) or 5xx (Server side errors) error. Other errors (e.g., authentication failure) will not be performed.
Type: Int32
Required: False
Position: Named
Default value: 0Specifies an API endpoint URL such like: https://your-api-endpoint.test/v1 If not specified, it will use https://api.openai.com/v1
Type: Uri
Required: False
Position: Named
Default value: https://api.openai.com/v1Specifies API key for authentication.
The type of data should [string] or [securestring].
If not specified, it will try to use $global:OPENAI_API_KEY or $env:OPENAI_API_KEY
Type: Object
Required: False
Position: NamedSpecifies Organization ID which used for an API request.
If not specified, it will try to use $global:OPENAI_ORGANIZATION or $env:OPENAI_ORGANIZATION
Type: string
Aliases: OrgId
Required: False
Position: NamedA list of File IDs that the message should use. There can be a maximum of 10 files attached to a message. Useful for tools like file_search and code_interpreter that can access and use files.
Type: String[]
Aliases: file_ids
Required: False
Position: NamedThe maximum number of prompt tokens that may be used over the course of the run.
Type: Int32
Aliases: max_prompt_tokens
Required: False
Position: NamedThe maximum number of completion tokens that may be used over the course of the run.
Type: Int32
Aliases: max_completion_tokens
Required: False
Position: NamedThe content of the message.
Type: String
Aliases: Content, Text
Required: True
Position: NamedAn array of images for reference to vision-compatible models. You can specify uploaded file id or URL of image.
Type: Object[]
Required: False
Position: NamedSpecifies the detail level of the image if specified by the user. "low" uses fewer tokens, you can opt in to high resolution using "high".
Type: String
Required: False
Position: Named
Default value: autoThe role of the entity that is creating the message. Allowed value is user or assistant.
Type: String
Required: False
Position: NamedControls which (if any) tool is called by the model. You can choose from auto, none, code_interpreter, retrieve or function.
Type: String
Aliases: tool_choice
Required: False
Position: NamedThe name of the function to call. You must specify this param when the ToolChoice is specified to function.
Type: String
Required: False
Position: NamedThe truncation strategy to use for the thread. The default is auto. You can choose from auto or last_messages
Type: String
Aliases: last_messages
Required: False
Position: Named
Default value: autoThe number of most recent messages from the thread when constructing the context for the run.
Type: Int32
Aliases: last_messages
Required: False
Position: NamedIf you want to explicitly send an extra query params, you can do so.
Type: IDictionary
Required: False
Position: NamedIf you want to explicitly send an extra headers, you can do so.
Type: IDictionary
Required: False
Position: NamedIf you want to explicitly send an extra body, you can do so.
Type: Object
Required: False
Position: NamedThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.