| |
The GetFirstMessage method returns the first available
message in the conversation history.
Syntax
object.GetFirstMessage(
[Prompt],
[Response],
[Timestamp],
[MessageId]
)
Parameters
- Prompt
- An optional String passed by reference. When the method returns, this
parameter will contain the message prompt for the oldest message in
the conversation history. If this parameter is omitted, the method
will not return the message prompt text. You cannot omit both this
parameter and the Response parameter.
- Response
- An optional String passed by reference. When the method returns, this
parameter will contain the response for the oldest message in the
conversation history. If this parameter is omitted, the method will
not return the response text. You cannot omit both this parameter
and the Prompt parameter.
- Timestamp
- An optional String or Date parameter passed by reference. When the
method returns, this parameter will contain the local date and time
the response was returned by the server. If this parameter is a
String, the timestamp is returned as a local date and time formatted
for the current user's locale. If the parameter is a Date, the value
is returned as a local date and time. If no timestamp is available,
a String parameter receives an empty string and a Date parameter
receives a value of zero. If this information is not required, this
parameter can be omitted.
- MessageId
- An optional Integer parameter passed by reference. When the
method returns, this parameter will contain the message ID
for the message. If this information is not required, this parameter
may be omitted.
Return Value
A value of True is returned if the method succeeds.
If there are no messages in the client history, or an error occurs,
the method returns False and the LastError
property will contain the error code.
Remarks
The GetFirstMessage method retrieves the first message
prompt and associated response from the client conversation history.
This method is typically used in conjunction with the GetNextMessage
method to enumerate all messages in the current session.
Messages are returned in chronological order, beginning with the
oldest message in the client history. New messages are always appended
to the end of the history, and if the history is trimmed, older messages
are removed first. The order of messages reflects the
sequence in which they were submitted.
See the Response property for additional information about
text formatting and Unicode handling for model responses.
To determine the number of messages in the conversation history,
use the MessageCount property.
Example
Dim strPrompt As String
Dim strResponse As String
Dim strTimestamp As String
Dim nMessageId As Long
If LlmClient1.GetFirstMessage(strPrompt, strResponse, strTimestamp, nMessageId) Then
Do
Debug.Print "Message ID: " & CStr(nMessageId)
Debug.Print "Prompt: " & strPrompt
Debug.Print "Response: " & strResponse
Debug.Print "Timestamp: " & strTimestamp
Debug.Print String(60, "-")
Loop While LlmClient1.GetNextMessage( _
strPrompt, _
strResponse, _
strTimestamp, _
nMessageId)
Else
MsgBox "No messages are available in the conversation history.", _
vbInformation
End If
See Also
HistorySize Property,
MessageCount Property,
Response Property,
GetMessage Method,
GetNextMessage Method
|
|