AI chat
AI chat · Type
Properties
Section titled “Properties”| Name | Type | Description |
|---|---|---|
argsLog | array | |
functionsCalled | array | |
lastFunctionCalled | FunctionInfo | |
model | string | |
requiredFunction | FunctionInfo |
Methods
Section titled “Methods”addFunction
Section titled “addFunction”chat.addFunction(functionInfo: FunctionInfo)
No description yet.
addTool
Section titled “addTool”chat.addTool(functionInfo: FunctionInfo)
No description yet.
generateChat
Section titled “generateChat”chat.generateChat(messages: array) → string
No description yet.
generateChatOrReturnFunctionCalled
Section titled “generateChatOrReturnFunctionCalled”chat.generateChatOrReturnFunctionCalled(messages: array) → string|FunctionInfo[]
This function exists to let the developer handle the tools calls on their own. It should not call the tools automatically.
generateChatStream
Section titled “generateChatStream”chat.generateChatStream(messages: array) → StreamInterface
No description yet.
generateChatStreamWithTools
Section titled “generateChatStreamWithTools”chat.generateChatStreamWithTools(messages: array, onTextDelta: callable)
Stream the assistant turn, looping through tool calls until the model finishes without requesting another tool. Mirrors the public surface of Minnow\LLPhant\Chat\AnthropicChat::generateChatStreamWithTools so GraceController’s method_exists($chat, 'generateChatStreamWithTools') branch lights up for the Mistral family.
Mistral La Plateforme speaks OpenAI-shape Server-Sent Events (deltas in choices[0].delta.{content,tool_calls}, final data: [DONE]), so this uses raw curl + SSE parsing rather than the SDK’s typed stream — the SDK’s CreateStreamedResponse path doesn’t carry a multi-turn tool loop.
generateStreamOfText
Section titled “generateStreamOfText”chat.generateStreamOfText(prompt: string) → StreamInterface
No description yet.
generateText
Section titled “generateText”chat.generateText(prompt: string) → string
No description yet.
generateTextOrReturnFunctionCalled
Section titled “generateTextOrReturnFunctionCalled”chat.generateTextOrReturnFunctionCalled(prompt: string) → string|FunctionInfo[]
No description yet.
getApiCalls
Section titled “getApiCalls”chat.getApiCalls() → int
No description yet.
getCacheReadTokens
Section titled “getCacheReadTokens”chat.getCacheReadTokens() → int
No description yet.
getInputTokens
Section titled “getInputTokens”chat.getInputTokens() → int
No description yet.
getLastResponse
Section titled “getLastResponse”chat.getLastResponse() → CreateResponse
No description yet.
getOutputTokens
Section titled “getOutputTokens”chat.getOutputTokens() → int
No description yet.
getTotalTokens
Section titled “getTotalTokens”chat.getTotalTokens() → int
No description yet.
getUsage
Section titled “getUsage”chat.getUsage() → CreateResponseUsage
No description yet.
setFunctions
Section titled “setFunctions”chat.setFunctions(functions: array)
No description yet.
setModelOption
Section titled “setModelOption”chat.setModelOption(option: string, value: mixed)
Mistral serves a repeated prompt prefix from its cache at a tenth of the input price, unasked; requests sharing this key are more likely to hit (docs.mistral.ai, prompt caching). Sent on the streaming and the non-streaming path. The key must not carry anything sensitive.
setPromptCacheKey
Section titled “setPromptCacheKey”chat.setPromptCacheKey(key: string)
No description yet.
setSystemMessage
Section titled “setSystemMessage”chat.setSystemMessage(message: string)
No description yet.
setTools
Section titled “setTools”chat.setTools(tools: array)
No description yet.