Expand description
Foundry Local Rust SDK
Local AI model inference powered by the Foundry Local Core engine.
Re-exports§
pub use crate::openai::AudioTranscriptionResponse;pub use crate::openai::AudioTranscriptionStream;pub use crate::openai::ChatCompletionStream;pub use crate::openai::ContentPart;pub use crate::openai::CoreErrorResponse;pub use crate::openai::LiveAudioTranscriptionOptions;pub use crate::openai::LiveAudioTranscriptionResponse;pub use crate::openai::LiveAudioTranscriptionSession;Deprecated pub use crate::openai::LiveAudioTranscriptionStream;pub use crate::openai::TranscriptionSegment;pub use crate::openai::TranscriptionWord;
Modules§
Structs§
- Audio
- An audio payload, inline or by URI, with format and PCM layout hints.
- Audio
Session - An audio-oriented
Sessionfor speech tasks (e.g. transcription). - Catalog
- The model catalog provides discovery and lookup for all available models.
- Chat
Choice - Chat
Choice Stream - Chat
Completion Message Tool Call - Chat
Completion Message Tool Call Chunk - Chat
Completion Named Tool Choice - Specifies a tool the model should use. Use to force the model to call a specific function.
- Chat
Completion Request Assistant Message - Chat
Completion Request System Message - Chat
Completion Request Tool Message - Tool message
- Chat
Completion Request User Message - Chat
Completion Response Message - A chat completion message generated by the model.
- Chat
Completion Stream Response Delta - A chat completion delta generated by streamed model responses.
- Chat
Session - A chat-oriented
Sessionwith tool registration and turn management. - Completion
Usage - Usage statistics for the completion request.
- Create
Chat Completion Response - Represents a chat completion response returned by model, based on the provided input.
- Create
Chat Completion Stream Response - Represents a streamed chunk of a chat completion response returned by the model, based on the provided input. Learn more.
- Download
Builder - Builder for configuring and running a model download.
- Embeddings
Session - An embeddings-oriented
Sessionproducing dense vectors for text input. - EpDownload
Builder - Builder for configuring and running execution provider downloads.
- EpDownload
Result - Result of a download-and-register execution-provider operation.
- EpInfo
- Information about an available execution provider.
- Foundry
Local Config - User-facing configuration for initializing the Foundry Local SDK.
- Foundry
Local Manager - Primary entry point for interacting with Foundry Local.
- Function
Call - The name and arguments of a function that should be called, as generated by the model.
- Function
Call Stream - Function
Object - Image
- An image payload, inline or by URI, with an optional
formathint (e.g.png). - Item
Queue - A thread-safe, multi-producer / multi-consumer queue of
Items. - Item
Stream - An asynchronous stream of output
Items fromSession::process_streaming_request. - Message
- A chat message: an author
roleplus ordered content parts. - Model
- The public model type.
- Model
Info - Full metadata for a model variant as returned by the catalog.
- Model
Settings - Model-level settings containing a list of parameters.
- Parameter
- A single parameter key-value pair used in model settings.
- Prompt
Template - Prompt template describing how messages are formatted for the model.
- Request
- A unit of work submitted to a
Session. - Request
Options - Options applied to a
Request(or, viaSession::set_options, to every request on a session). - Response
- The result of processing a
Request: output items plus the finish reason and token usage. - Runtime
- Runtime information for a model (device type and execution provider).
- Search
Options - Sampling / decoding parameters applied to a request or session.
- Session
- A stateful inference session bound to a
Model. - Speech
Result - A complete speech-recognition result (output-only).
- Speech
Segment - One speech-recognition segment (output-only).
- Speech
Word - One recognized word within a
SpeechSegment(output-only). - Tensor
- A numeric tensor: an element
data_type, ashape, and the raw little-endian element bytes. - Tool
Call - A model-issued request to invoke a named tool/function.
- Tool
Definition - A tool the model may call, registered on a
ChatSession. - Tool
Result - The result of executing a
ToolCall, fed back to the model. - Usage
- Token accounting for a
Response.
Enums§
- Chat
Completion Message Tool Calls - Chat
Completion Request Message - Chat
Completion Tool Choice Option - Controls which (if any) tool is called by the model.
nonemeans the model will not call any tool and instead generates a message.automeans the model can pick between generating a message or calling one or more tools.requiredmeans the model must call one or more tools. Specifying a particular tool via{"type": "function", "function": {"name": "my_function"}}forces the model to call that tool. - Chat
Completion Tools - Chat
Finish Reason - Chat
Response Format - Desired response format for chat completions.
- Chat
Tool Choice - Tool choice configuration for chat completions.
- Device
Type - Hardware device type for model execution.
- Finish
Reason - Why generation stopped for a
Response. - Foundry
Local Error - Errors that can occur when using the Foundry Local SDK.
- Item
- A single unit of input or output data exchanged with a
Session. - Item
Type - The kind of payload carried by an
Item. - LogLevel
- Log level for the Foundry Local service.
- Media
Source - The source of an
ImageorAudiopayload: inline bytes or a URI. - Message
Role - The author role of a chat
Message. - Native
Error Code - Stable error codes reported by the native Foundry Local library.
- Speech
Segment Kind - Whether a
SpeechSegmentis an interim hypothesis or a stable result. - Tensor
Data Type - The element data type of a
Tensor, mirroring ONNX tensor element types. - Text
Kind - The subtype of a
Item::Textpayload. - Tool
Choice - How a tool-enabled request should select among available tools.
Traits§
- Logger
- Application-level logger that the SDK can use to emit diagnostic messages.