Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions crates/lingua/src/processing/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::capabilities::ProviderFormat;
use crate::error::ConvertError;
use crate::processing::adapters::{adapter_for_format, adapters, ProviderAdapter};
#[cfg(feature = "openai")]
use crate::providers::openai::model_supports_max_tokens;
use crate::providers::openai::model_needs_transforms;
use crate::serde_json::Value;
use crate::universal::{UniversalResponse, UniversalStreamChunk};
use thiserror::Error;
Expand Down Expand Up @@ -509,11 +509,9 @@ fn needs_forced_translation(payload: &Value, model: Option<&str>, target: Provid

#[cfg(feature = "openai")]
{
// If the model doesn't support max_tokens, we need to force translation
// Force translation if model needs any transforms (temperature stripping, max_tokens conversion, etc.)
let request_model = payload.get("model").and_then(Value::as_str).or(model);
request_model
.map(|m| !model_supports_max_tokens(m))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically we force translation in order for "capabilities" to apply

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for context i added -> deb50d6

.unwrap_or(false)
request_model.map(model_needs_transforms).unwrap_or(false)
}

#[cfg(not(feature = "openai"))]
Expand Down
Loading