* packages/demos/mimo/mimo.h
*
* Copyright (C) 2024 Xiaomi Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
****************************************************************************/
#ifndef __DEMOS_MIMO_H
#define __DEMOS_MIMO_H
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
* Pre-processor Definitions
****************************************************************************/
#define MIMO_MAX_MESSAGES 32
#define MIMO_MAX_RESPONSE (32 * 1024)
#define MIMO_MAX_TOOL_RESULT (8 * 1024)
#define MIMO_MAX_URL_LEN 256
#define MIMO_MAX_TOOLS 16
#define MIMO_API_KEY CONFIG_MIMO_API_KEY
#define MIMO_MODEL CONFIG_MIMO_MODEL
#define MIMO_API_BASE_URL CONFIG_MIMO_API_BASE_URL
#define MIMO_TEMPERATURE CONFIG_MIMO_TEMPERATURE
* Public Types
****************************************************************************/
enum mimo_role_e
{
MIMO_ROLE_SYSTEM = 0,
MIMO_ROLE_USER,
MIMO_ROLE_ASSISTANT,
MIMO_ROLE_TOOL
};
struct mimo_message_s
{
enum mimo_role_e role;
char *content;
char *tool_call_id;
char *tool_name;
char *reasoning_content;
};
struct mimo_chat_req_s
{
const char *model;
const char *system_prompt;
struct mimo_message_s *messages;
int message_count;
const char *tools_json;
int temperature;
};
struct mimo_chat_resp_s
{
char *content;
char *tool_call_id;
char *tool_name;
char *tool_input;
char *reasoning_content;
bool is_tool_use;
};
* Public Function Prototypes - Provider
****************************************************************************/
int mimo_provider_init(const char *api_key, const char *base_url);
int mimo_provider_chat(const struct mimo_chat_req_s *req,
struct mimo_chat_resp_s *resp);
void mimo_chat_resp_free(struct mimo_chat_resp_s *resp);
void mimo_provider_destroy(void);
* Public Function Prototypes - Agent
****************************************************************************/
int mimo_agent_init(void);
int mimo_agent_chat(const char *user_input, char **response);
#endif