Skip to main content

objectiveai_sdk/functions/
mod.rs

1//! Function definitions, profiles, and execution types.
2//!
3//! Functions are composable scoring pipelines that transform structured input
4//! into scores. They are the primary interface for most ObjectiveAI users.
5//!
6//! # Overview
7//!
8//! A Function consists of:
9//! - **Input schema** - Defines expected input structure
10//! - **Input maps** - Optional expressions to transform input into arrays for mapped tasks
11//! - **Tasks** - A list of operations (Vector Completions or nested Functions)
12//! - **Output** - Expression that combines task results into final score(s)
13//!
14//! # Function Types
15//!
16//! - [`RemoteFunction`] - Remote function with description and schema
17//! - [`InlineFunction`] - Inline function definition without metadata
18//! - **Scalar** - Produces a single score in [0, 1]
19//! - **Vector** - Produces a vector of scores that sums to 1
20//!
21//! # Task Types
22//!
23//! - [`ScalarFunctionTask`] - Calls a scalar function
24//! - [`VectorFunctionTask`] - Calls a vector function
25//! - [`VectorCompletionTask`] - Runs a vector completion
26//!
27//! # Client-Side Compilation
28//!
29//! Functions use expressions (JMESPath or Starlark) for dynamic behavior. The SDK
30//! can compile these expressions client-side to preview results during Function authoring:
31//!
32//! - [`Function::compile_tasks`] - Resolves task expressions to show final tasks for a given input
33//! - [`Function::compile_output`] - Computes the final output given input and task outputs
34//!
35//! # Submodules
36//!
37//! - [`executions`] - Function execution request/response types
38//! - [`expression`] - Expression evaluation engine (JMESPath and Starlark)
39//! - [`profiles`] - Profile management and computation
40
41pub mod alpha_scalar;
42pub mod alpha_vector;
43pub mod check;
44pub mod executions;
45pub mod expression;
46mod full_function;
47mod function;
48pub mod inventions;
49mod profile;
50pub mod profiles;
51pub mod request;
52pub mod response;
53mod task;
54
55pub use full_function::*;
56pub use function::*;
57pub use profile::*;
58pub use task::*;
59
60#[cfg(feature = "http")]
61mod http;
62
63#[cfg(feature = "http")]
64pub use http::*;