带预设的高级会话创建。允许在初始化时注入系统提示词、多轮历史消息及工具 (Tools) 架构定义。
void* LiteRtLm_CreateConversationWithConfig(
void* engine_ptr,
const char* json_preface_str,
int bEnableConstrainedDecoding
);
| 参数名称 | 职责说明 |
|---|---|
json_preface_str |
JSON 格式的预设字符串。 包含 "messages" 数组和 "tools" 定义。必须符合 OpenAI API 格式标准的子集。
|
bEnableConstrainedDecoding |
强制约束开关。 设为 1 时,引擎将根据 tools 定义自动启用 JSON 强约束,确保 AI 必须按格式输出工具调用。
|
{
"messages": [
{"role": "system", "content": "You are a helpful companion."},
{"role": "user", "content": "Hello!"}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"parameters": { "type": "object", "properties": {...} }
}
}
]
}