# AiTranslationManager

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-protranslate-studio/struct-aitranslationmanager/

**struct** · [`ferroui-protranslate-studio`](/docs/0.5.0/api/ferroui-protranslate-studio/) · v0.5.0

```rust
struct AiTranslationManager
```

Stable provider ordering matches the source manager. Errors never trigger paid retries.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L445)

## Members

- [`new`](#function-new)
- [`configure`](#function-configure)
- [`apply_settings`](#function-apply_settings)
- [`providers`](#function-providers)
- [`configured_providers`](#function-configured_providers)
- [`configuration`](#function-configuration)
- [`translate_with_provider`](#function-translate_with_provider)
- [`translate_with_best_available`](#function-translate_with_best_available)
- [`translate_single`](#function-translate_single)
- [`test_connection`](#function-test_connection)
- [`translate_batches`](#function-translate_batches)
- [`list_models`](#function-list_models)
- [`compatibility_model_list`](#function-compatibility_model_list)

<a id="function-new"></a>

### new

```rust
fn new(transport: Rc<dyn AiTransport>) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L450)

<a id="function-configure"></a>

### configure

```rust
fn configure(self: &mut Self, configuration: AiProviderConfig) -> Result<(), StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L459)

<a id="function-apply_settings"></a>

### apply_settings

```rust
fn apply_settings(self: &mut Self, configurations: &[AiProviderConfig]) -> Result<(), StudioError>
```

Validate the entire update before replacing any configuration.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L466)

<a id="function-providers"></a>

### providers

```rust
fn providers(self: &Self) -> &[AiProvider; 3]
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L482)

<a id="function-configured_providers"></a>

### configured_providers

```rust
fn configured_providers(self: &Self) -> Vec<AiProvider>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L485)

<a id="function-configuration"></a>

### configuration

```rust
fn configuration(self: &Self, provider: AiProvider) -> &AiProviderConfig
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L492)

<a id="function-translate_with_provider"></a>

### translate_with_provider

```rust
async fn translate_with_provider(self: &Self, provider: AiProvider, request: &AiTranslationRequest, cancellation: &CancellationToken) -> Result<AiTranslationResult, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L495)

<a id="function-translate_with_best_available"></a>

### translate_with_best_available

```rust
async fn translate_with_best_available(self: &Self, request: &AiTranslationRequest, cancellation: &CancellationToken) -> Result<AiTranslationResult, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L529)

<a id="function-translate_single"></a>

### translate_single

```rust
async fn translate_single(self: &Self, provider: AiProvider, source_text: &str, source_language: &str, target_language: &str, context: &str, cancellation: &CancellationToken) -> Result<String, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L543)

<a id="function-test_connection"></a>

### test_connection

```rust
async fn test_connection(self: &Self, provider: AiProvider, cancellation: &CancellationToken) -> Result<bool, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L566)

<a id="function-translate_batches"></a>

### translate_batches

```rust
async fn translate_batches(self: &Self, provider: AiProvider, request: &AiTranslationRequest, batch_size: usize, cancellation: &CancellationToken, progress: &mut dyn FnMut(AiBatchProgress, &AiTranslationResult) -> ()) -> Result<AiBatchResult, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L576)

<a id="function-list_models"></a>

### list_models

```rust
async fn list_models(self: &Self, provider: AiProvider, cancellation: &CancellationToken) -> Result<AiModelList, StudioError>
```

Discover current models without requiring a model selection. Failed or incomplete
discovery is an error; an empty successful listing remains empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L630)

<a id="function-compatibility_model_list"></a>

### compatibility_model_list

```rust
fn compatibility_model_list(provider: AiProvider) -> AiModelList
```

Explicit access to the original application's historical model list.
This performs no discovery, implies no availability, and changes no configuration.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/ai.rs#L646)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
