Closed JianSuWaymark closed 4 months ago
/@azure/openai/types/src/models/models.d.ts
:
/** An abstract representation of a chat message as provided in a request. */
export type ChatRequestMessage = ChatRequestSystemMessage | ChatRequestUserMessage | ChatRequestAssistantMessage | ChatRequestToolMessage | ChatRequestFunctionMessage;
/**
* A request chat message containing system instructions that influence how the model will generate a chat completions
* response.
*/
export interface ChatRequestSystemMessage {
/** The chat role associated with this message, which is always 'system' for system messages. */
role: "system";
/** The contents of the system message. */
content: string;
/** An optional name for the participant. */
name?: string;
}
/** A request chat message representing user input to the assistant. */
export interface ChatRequestUserMessage {
/** The chat role associated with this message, which is always 'user' for user messages. */
role: "user";
/** The contents of the user message, with available input types varying by selected model. */
content: string | Array<ChatMessageContentItem>;
/** An optional name for the participant. */
name?: string;
}
/** A request chat message representing response or action from the assistant. */
export interface ChatRequestAssistantMessage {
/** The chat role associated with this message, which is always 'assistant' for assistant messages. */
role: "assistant";
/** The content of the message. */
content: string | null;
/** An optional name for the participant. */
name?: string;
/**
* The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat
* completions request to resolve as configured.
*/
toolCalls?: Array<ChatCompletionsToolCall>;
/**
* The function call that must be resolved and have its output appended to subsequent input messages for the chat
* completions request to resolve as configured.
*/
functionCall?: FunctionCall;
}
/** A request chat message representing requested output from a configured tool. */
export interface ChatRequestToolMessage {
/** The chat role associated with this message, which is always 'tool' for tool messages. */
role: "tool";
/** The content of the message. */
content: string | null;
/** The ID of the tool call resolved by the provided content. */
toolCallId: string;
}
/** A request chat message representing requested output from a configured function. */
export interface ChatRequestFunctionMessage {
/** The chat role associated with this message, which is always 'function' for function messages. */
role: "function";
/** The name of the function that was called to produce output. */
name: string;
/** The output of the function as requested by the function call. */
content: string | null;
}
/openai/resources/chat/completions.d.ts
export type ChatCompletionMessageParam = ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam | ChatCompletionAssistantMessageParam | ChatCompletionToolMessageParam | ChatCompletionFunctionMessageParam;
export interface ChatCompletionSystemMessageParam {
/**
* The contents of the system message.
*/
content: string;
/**
* The role of the messages author, in this case `system`.
*/
role: 'system';
/**
* An optional name for the participant. Provides the model information to
* differentiate between participants of the same role.
*/
name?: string;
}
export interface ChatCompletionUserMessageParam {
/**
* The contents of the user message.
*/
content: string | Array<ChatCompletionContentPart>;
/**
* The role of the messages author, in this case `user`.
*/
role: 'user';
/**
* An optional name for the participant. Provides the model information to
* differentiate between participants of the same role.
*/
name?: string;
}
export interface ChatCompletionAssistantMessageParam {
/**
* The role of the messages author, in this case `assistant`.
*/
role: 'assistant';
/**
* The contents of the assistant message. Required unless `tool_calls` or
* `function_call` is specified.
*/
content?: string | null;
/**
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
* a function that should be called, as generated by the model.
*/
function_call?: ChatCompletionAssistantMessageParam.FunctionCall;
/**
* An optional name for the participant. Provides the model information to
* differentiate between participants of the same role.
*/
name?: string;
/**
* The tool calls generated by the model, such as function calls.
*/
tool_calls?: Array<ChatCompletionMessageToolCall>;
}
export interface ChatCompletionToolMessageParam {
/**
* The contents of the tool message.
*/
content: string;
/**
* The role of the messages author, in this case `tool`.
*/
role: 'tool';
/**
* Tool call that this message is responding to.
*/
tool_call_id: string;
}
/**
* @deprecated
*/
export interface ChatCompletionFunctionMessageParam {
/**
* The contents of the function message.
*/
content: string | null;
/**
* The name of the function to call.
*/
name: string;
/**
* The role of the messages author, in this case `function`.
*/
role: 'function';
}
appreciate your help Jian!
changes from
ChatRequestMessage
toOpenAI.Chat.Completions.ChatCompletionMessageParam[]
ChatCompletionsFunctionToolDefinition[
toOpenAI.Chat.Completions.ChatCompletionTool[]
Differences in the naming of parameters: (toolCalls
:tool_calls
), (functionCall
:function_call
), (toolCallId
:tool_call_id
).