#ifndef OPEN_WING_LLM_H
#define OPEN_WING_LLM_H

#include "config.h"

typedef struct {
    char* id;
    char* name;
    char* arguments_json;
} llm_tool_call_t;

typedef struct {
    char* content;
    llm_tool_call_t* tool_calls;
    int tool_call_count;
    char* finish_reason;
} llm_response_t;

int llm_init(const llm_config_t* config);
char* llm_chat(const char* system_prompt, const char* user_message);
int llm_chat_with_tools(const char* system_prompt,
                        const char* user_message,
                        const char* tools_json,
                        llm_response_t* out_response);
int llm_chat_with_tools_messages(const char* messages_json,
                                 const char* tools_json,
                                 const char* tool_choice,
                                 llm_response_t* out_response);
void llm_response_free(llm_response_t* response);
int llm_get_config(llm_config_t* out_config);
int llm_set_config(const llm_config_t* config);
char* llm_list_models_json(const char* base_url_override);
char* llm_get_json_path(const char* base_url_override, const char* path);
void llm_cleanup(void);

#endif