Skip to main content

Crate foundry_local_sdk

Crate foundry_local_sdk 

Source
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§

openai

Structs§

Audio
An audio payload, inline or by URI, with format and PCM layout hints.
AudioSession
An audio-oriented Session for speech tasks (e.g. transcription).
Catalog
The model catalog provides discovery and lookup for all available models.
ChatChoice
ChatChoiceStream
ChatCompletionMessageToolCall
ChatCompletionMessageToolCallChunk
ChatCompletionNamedToolChoice
Specifies a tool the model should use. Use to force the model to call a specific function.
ChatCompletionRequestAssistantMessage
ChatCompletionRequestSystemMessage
ChatCompletionRequestToolMessage
Tool message
ChatCompletionRequestUserMessage
ChatCompletionResponseMessage
A chat completion message generated by the model.
ChatCompletionStreamResponseDelta
A chat completion delta generated by streamed model responses.
ChatSession
A chat-oriented Session with tool registration and turn management.
CompletionUsage
Usage statistics for the completion request.
CreateChatCompletionResponse
Represents a chat completion response returned by model, based on the provided input.
CreateChatCompletionStreamResponse
Represents a streamed chunk of a chat completion response returned by the model, based on the provided input. Learn more.
DownloadBuilder
Builder for configuring and running a model download.
EmbeddingsSession
An embeddings-oriented Session producing dense vectors for text input.
EpDownloadBuilder
Builder for configuring and running execution provider downloads.
EpDownloadResult
Result of a download-and-register execution-provider operation.
EpInfo
Information about an available execution provider.
FoundryLocalConfig
User-facing configuration for initializing the Foundry Local SDK.
FoundryLocalManager
Primary entry point for interacting with Foundry Local.
FunctionCall
The name and arguments of a function that should be called, as generated by the model.
FunctionCallStream
FunctionObject
Image
An image payload, inline or by URI, with an optional format hint (e.g. png).
ItemQueue
A thread-safe, multi-producer / multi-consumer queue of Items.
ItemStream
An asynchronous stream of output Items from Session::process_streaming_request.
Message
A chat message: an author role plus ordered content parts.
Model
The public model type.
ModelInfo
Full metadata for a model variant as returned by the catalog.
ModelSettings
Model-level settings containing a list of parameters.
Parameter
A single parameter key-value pair used in model settings.
PromptTemplate
Prompt template describing how messages are formatted for the model.
Request
A unit of work submitted to a Session.
RequestOptions
Options applied to a Request (or, via Session::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).
SearchOptions
Sampling / decoding parameters applied to a request or session.
Session
A stateful inference session bound to a Model.
SpeechResult
A complete speech-recognition result (output-only).
SpeechSegment
One speech-recognition segment (output-only).
SpeechWord
One recognized word within a SpeechSegment (output-only).
Tensor
A numeric tensor: an element data_type, a shape, and the raw little-endian element bytes.
ToolCall
A model-issued request to invoke a named tool/function.
ToolDefinition
A tool the model may call, registered on a ChatSession.
ToolResult
The result of executing a ToolCall, fed back to the model.
Usage
Token accounting for a Response.

Enums§

ChatCompletionMessageToolCalls
ChatCompletionRequestMessage
ChatCompletionToolChoiceOption
Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means 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.
ChatCompletionTools
ChatFinishReason
ChatResponseFormat
Desired response format for chat completions.
ChatToolChoice
Tool choice configuration for chat completions.
DeviceType
Hardware device type for model execution.
FinishReason
Why generation stopped for a Response.
FoundryLocalError
Errors that can occur when using the Foundry Local SDK.
Item
A single unit of input or output data exchanged with a Session.
ItemType
The kind of payload carried by an Item.
LogLevel
Log level for the Foundry Local service.
MediaSource
The source of an Image or Audio payload: inline bytes or a URI.
MessageRole
The author role of a chat Message.
NativeErrorCode
Stable error codes reported by the native Foundry Local library.
SpeechSegmentKind
Whether a SpeechSegment is an interim hypothesis or a stable result.
TensorDataType
The element data type of a Tensor, mirroring ONNX tensor element types.
TextKind
The subtype of a Item::Text payload.
ToolChoice
How a tool-enabled request should select among available tools.

Traits§

Logger
Application-level logger that the SDK can use to emit diagnostic messages.