use crate::shapes::{
LLM_CALL_OPTIONS, LLM_CALL_RESULT, LLM_CALL_SAFE_RESULT, SCHEMA_RECOVER_ENVELOPE,
};
use crate::{BuiltinSignature, Param, Ty, TY_ANY, TY_DICT, TY_DICT_OR_NIL, TY_LIST, TY_STRING};
const TY_SCHEMA_VALUE: Ty = Ty::Union(&[TY_DICT, Ty::Apply("Schema", &[TY_ANY])]);
pub const LLM_CALL: BuiltinSignature = BuiltinSignature::simple(
"llm_call",
&[
Param::new("prompt", TY_STRING),
Param::optional("system", TY_STRING),
Param::optional("options", LLM_CALL_OPTIONS),
],
LLM_CALL_RESULT,
);
pub const LLM_CALL_SAFE: BuiltinSignature = BuiltinSignature::simple(
"llm_call_safe",
&[
Param::new("prompt", TY_STRING),
Param::optional("system", TY_STRING),
Param::optional("options", LLM_CALL_OPTIONS),
],
LLM_CALL_SAFE_RESULT,
);
pub const LLM_COMPLETION: BuiltinSignature = BuiltinSignature::simple(
"llm_completion",
&[
Param::new("prefix", TY_STRING),
Param::optional("suffix", TY_STRING),
Param::optional("system", TY_STRING),
Param::optional("options", LLM_CALL_OPTIONS),
],
LLM_CALL_RESULT,
);
pub const LLM_CALL_STRUCTURED: BuiltinSignature = BuiltinSignature::simple(
"llm_call_structured",
&[
Param::new("prompt", TY_STRING),
Param::new("schema", TY_SCHEMA_VALUE),
Param::optional("options", LLM_CALL_OPTIONS),
],
TY_ANY,
);
pub const LLM_CALL_STRUCTURED_SAFE: BuiltinSignature = BuiltinSignature::simple(
"llm_call_structured_safe",
&[
Param::new("prompt", TY_STRING),
Param::new("schema", TY_SCHEMA_VALUE),
Param::optional("options", LLM_CALL_OPTIONS),
],
TY_DICT,
);
pub const LLM_CALL_STRUCTURED_RESULT: BuiltinSignature = BuiltinSignature::simple(
"llm_call_structured_result",
&[
Param::new("prompt", TY_STRING),
Param::new("schema", TY_SCHEMA_VALUE),
Param::optional("options", LLM_CALL_OPTIONS),
],
TY_ANY,
);
pub const LLM_CATALOG: BuiltinSignature = BuiltinSignature::simple("llm_catalog", &[], TY_LIST);
pub const LLM_CATALOG_REFRESH: BuiltinSignature = BuiltinSignature::simple(
"llm_catalog_refresh",
&[Param::optional("options", TY_DICT_OR_NIL)],
TY_DICT,
);
pub const LLM_PROVIDER_STATUS: BuiltinSignature =
BuiltinSignature::simple("llm_provider_status", &[], TY_LIST);
pub const SCHEMA_RECOVER: BuiltinSignature = BuiltinSignature::generic(
"schema_recover",
&["T"],
&[
Param::new("text", TY_STRING),
Param::new("schema", Ty::SchemaOf("T")),
Param::optional("options", TY_DICT_OR_NIL),
],
SCHEMA_RECOVER_ENVELOPE,
);