| external help file | PSOpenAI-help.xml |
|---|---|
| Module Name | PSOpenAI |
| online version | https://github.com/mkht/PSOpenAI/blob/main/Docs/Add-ConversationItem.md |
| schema | 2.0.0 |
Adds a message to a Conversation.
Add-ConversationItem
-ConversationId <String>
[-Message <String>]
[-Role <String>]
[-SystemMessage <String[]>]
[-DeveloperMessage <String[]>]
[-Images <String[]>]
[-ImageDetail <String>]
[-Files <String[]>]
[-Include <String[]>]
[-PassThru]
[-TimeoutSec <Int32>]
[-MaxRetryCount <Int32>]
[-ApiBase <Uri>]
[-ApiKey <SecureString>]
[<CommonParameters>]
Adds a message, file, image, or other content to a Conversation.
Typically used to add user messages to a conversation.
PS C:\> Add-ConversationItem -ConversationId "conv_abc1234" -Message "Hello, what's the weather today?"Adds a message to the specified Conversation. No output by default.
PS C:\> Add-ConversationItem -ConversationId "conv_abc1234" -Message "Please analyze this image" -Images "C:\images\sample.png"Adds a message with an attached image file.
PS C:\> Add-ConversationItem -ConversationId "conv_abc1234" -Message "Please check the file" -Files "C:\docs\sample.pdf" -PassThruAdds a message with an attached file and returns the Conversation object when PassThru is specified.
The ID of the conversation to add the item to.
Type: String
Aliases: Conversation, conversation_id
Required: True
Position: Named
Accept pipeline input: True (ByPropertyName, ByValue)The content of the user message to add.
Type: String
Required: False
Position: 0Specifies the role of the message. One of user, system, developer, or assistant.
Type: String
Required: False
Position: Named
Default value: userSpecifies one or more system messages.
Type: String[]
Aliases: system
Required: False
Position: NamedSpecifies one or more developer messages.
Type: String[]
Required: False
Position: NamedSpecifies the path, URL, or file ID of image files to attach.
Type: String[]
Required: False
Position: NamedSpecifies the detail level of the image. One of auto, low, or high.
Type: String
Required: False
Position: Named
Default value: autoSpecifies the path, URL, or file ID of files to attach.
Type: String[]
Required: False
Position: NamedAdditional fields to include in the response.
Type: String[]
Required: False
Position: NamedSpecifies the request timeout in seconds. 0 means unlimited.
Type: Int32
Required: False
Position: Named
Default value: 0Number between 0 and 100. Specifies the maximum number of retries for 429/5xx errors.
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: System.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 the organization ID.
Type: String
Aliases: OrgId
Required: False
Position: NamedWhen specified, returns the Conversation object after adding the message.
Type: SwitchParameter
Required: False
Position: Named