mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-08 03:10:26 +00:00
Fix OpenAI-compatible parity fixture
This commit is contained in:
parent
ca11cac25d
commit
5d345cf393
4 changed files with 18 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ use fabro_auth::EnvCredentialSource;
|
|||
use fabro_llm::client::Client;
|
||||
use fabro_llm::provider::ProviderAdapter;
|
||||
use fabro_llm::providers::{OpenAiAdapter, OpenAiCompatibleAdapter};
|
||||
use fabro_model::catalog::{LlmCatalogSettings, ProviderCatalogSettings};
|
||||
use fabro_model::{Catalog, ModelHandle, ProviderId};
|
||||
use fabro_test::{TwinScenario, TwinScenarios, TwinToolCall, twin_openai};
|
||||
use tokio::sync::Mutex as AsyncMutex;
|
||||
|
|
@ -184,7 +185,20 @@ fn make_openai_compatible_twin_session(
|
|||
twin: &OpenAiTwinOptions,
|
||||
) -> Session {
|
||||
let client = make_openai_compatible_twin_client(&provider, twin);
|
||||
let catalog = Arc::new(Catalog::from_builtin().expect("default catalog should build"));
|
||||
// LiteLLM is opt-in in the built-in catalog. Enable the provider in this
|
||||
// twin fixture so the profile can resolve the same OpenAI-compatible
|
||||
// codec that the manually registered adapter uses.
|
||||
let mut settings = LlmCatalogSettings::default();
|
||||
settings
|
||||
.providers
|
||||
.insert(provider.to_string(), ProviderCatalogSettings {
|
||||
enabled: Some(true),
|
||||
..ProviderCatalogSettings::default()
|
||||
});
|
||||
let catalog = Arc::new(
|
||||
Catalog::from_builtin_with_overrides(&settings)
|
||||
.expect("OpenAI-compatible twin catalog should build"),
|
||||
);
|
||||
let profile: Arc<dyn AgentProfile> = Arc::new(
|
||||
OpenAiProfile::new(model)
|
||||
.with_provider_id(provider)
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ Supported `/v1/responses` fields:
|
|||
Supported `/v1/chat/completions` fields:
|
||||
|
||||
- bearer auth
|
||||
- `max_tokens`
|
||||
- `stream`
|
||||
- `tools`
|
||||
- `tool_choice`
|
||||
|
|
|
|||
|
|
@ -531,6 +531,7 @@ pub fn normalize_whitespace(input: &str) -> String {
|
|||
pub struct ChatCompletionsRequest {
|
||||
pub model: String,
|
||||
pub messages: Vec<ChatMessage>,
|
||||
pub max_tokens: Option<i64>,
|
||||
#[serde(default)]
|
||||
pub stream: bool,
|
||||
pub tools: Option<Vec<Value>>,
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ async fn chat_completions_accepts_supported_openai_compatible_fields() {
|
|||
},
|
||||
{ "role": "user", "content": "structured chat" }
|
||||
],
|
||||
"max_tokens": 128,
|
||||
"stream": false,
|
||||
"tools": [{ "type": "function", "function": { "name": "lookup" } }],
|
||||
"tool_choice": "auto",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue