All configuration is now done exclusively through mimi_secrets.h at build time. Removed NVS read/write logic, CLI config commands (wifi_set, set_tg_token, set_api_key, set_model, set_proxy, clear_proxy, set_search_key), and setter functions from all modules. CLI retains debug/maintenance commands only. Updated all documentation to reflect the change. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
59 lines
1.9 KiB
C
59 lines
1.9 KiB
C
#pragma once
|
|
|
|
#include "esp_err.h"
|
|
#include "cJSON.h"
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "mimi_config.h"
|
|
|
|
/**
|
|
* Initialize the LLM proxy.
|
|
*/
|
|
esp_err_t llm_proxy_init(void);
|
|
|
|
/**
|
|
* Send a chat completion request to Anthropic Messages API (streaming).
|
|
*
|
|
* @param system_prompt System prompt string
|
|
* @param messages_json JSON array of messages: [{"role":"user","content":"..."},...]
|
|
* @param response_buf Output buffer for the complete response text
|
|
* @param buf_size Size of response_buf
|
|
* @return ESP_OK on success
|
|
*/
|
|
esp_err_t llm_chat(const char *system_prompt, const char *messages_json,
|
|
char *response_buf, size_t buf_size);
|
|
|
|
/* ── Tool Use Support ──────────────────────────────────────────── */
|
|
|
|
typedef struct {
|
|
char id[64]; /* "toolu_xxx" */
|
|
char name[32]; /* "web_search" */
|
|
char *input; /* heap-allocated JSON string */
|
|
size_t input_len;
|
|
} llm_tool_call_t;
|
|
|
|
typedef struct {
|
|
char *text; /* accumulated text blocks */
|
|
size_t text_len;
|
|
llm_tool_call_t calls[MIMI_MAX_TOOL_CALLS];
|
|
int call_count;
|
|
bool tool_use; /* stop_reason == "tool_use" */
|
|
} llm_response_t;
|
|
|
|
void llm_response_free(llm_response_t *resp);
|
|
|
|
/**
|
|
* Send a chat completion request with tools to Anthropic Messages API (streaming).
|
|
*
|
|
* @param system_prompt System prompt string
|
|
* @param messages cJSON array of messages (caller owns)
|
|
* @param tools_json Pre-built JSON string of tools array, or NULL for no tools
|
|
* @param resp Output: structured response with text and tool calls
|
|
* @return ESP_OK on success
|
|
*/
|
|
esp_err_t llm_chat_tools(const char *system_prompt,
|
|
cJSON *messages,
|
|
const char *tools_json,
|
|
llm_response_t *resp);
|