pub struct FoundryClient { /* private fields */ }Expand description
Microsoft Foundry API client
Implementations§
Source§impl FoundryClient
impl FoundryClient
Sourcepub fn from_connection(conn: &FoundryConnection) -> Result<Self, ClientError>
pub fn from_connection(conn: &FoundryConnection) -> Result<Self, ClientError>
Create a client from a workspace foundry connection (v1 data plane).
Sourcepub fn new(config: &FoundryServiceConfig) -> Result<Self, ClientError>
pub fn new(config: &FoundryServiceConfig) -> Result<Self, ClientError>
Create a new Foundry client from service configuration (legacy).
Sourcepub fn with_auth(
base_url: String,
project: String,
api_version: String,
auth: Box<dyn AuthProvider>,
) -> Result<Self, ClientError>
pub fn with_auth( base_url: String, project: String, api_version: String, auth: Box<dyn AuthProvider>, ) -> Result<Self, ClientError>
Create with a custom auth provider (for testing)
Sourcepub fn with_features(self, features: &[&str]) -> Self
pub fn with_features(self, features: &[&str]) -> Self
Enable preview feature gates sent via the Foundry-Features header.
Sourcepub async fn agent_respond(
&self,
agent: &str,
input: &str,
) -> Result<Value, ClientError>
pub async fn agent_respond( &self, agent: &str, input: &str, ) -> Result<Value, ClientError>
Invoke an agent with a single prompt via the Foundry responses API
(POST {project}/openai/v1/responses); returns the raw OpenAI-shaped
response object.
Sourcepub async fn list_agents(&self) -> Result<Vec<Value>, ClientError>
pub async fn list_agents(&self) -> Result<Vec<Value>, ClientError>
List all agents in the project
Sourcepub async fn get_agent(&self, id: &str) -> Result<Value, ClientError>
pub async fn get_agent(&self, id: &str) -> Result<Value, ClientError>
Get a specific agent by ID
Sourcepub async fn create_agent(
&self,
definition: &Value,
) -> Result<Value, ClientError>
pub async fn create_agent( &self, definition: &Value, ) -> Result<Value, ClientError>
Create a new agent (creates first version)
Takes a flat agent definition and wraps it in the API format
before posting to /agents/{name}/versions.
Sourcepub async fn update_agent(
&self,
id: &str,
definition: &Value,
) -> Result<Value, ClientError>
pub async fn update_agent( &self, id: &str, definition: &Value, ) -> Result<Value, ClientError>
Update an existing agent (creates new version)
Takes a flat agent definition and wraps it in the API format
before posting to /agents/{name}/versions.
Sourcepub async fn delete_agent(&self, id: &str) -> Result<(), ClientError>
pub async fn delete_agent(&self, id: &str) -> Result<(), ClientError>
Delete an agent
Sourcepub fn auth_method(&self) -> &'static str
pub fn auth_method(&self) -> &'static str
Get the authentication method being used