mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-24 00:51:19 +00:00
test(agent): inject catalog in profile guardrail
This commit is contained in:
parent
de5c27ca20
commit
805912d790
1 changed files with 19 additions and 6 deletions
|
|
@ -1,10 +1,15 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use fabro_agent::{AgentProfile, AnthropicProfile, GeminiProfile, OpenAiProfile};
|
||||
use fabro_model::catalog::LlmCatalogSettings;
|
||||
use fabro_model::{Catalog, Provider};
|
||||
|
||||
#[test]
|
||||
fn profile_context_window_matches_catalog_for_default_models() {
|
||||
let catalog =
|
||||
Arc::new(Catalog::from_builtin_with_overrides(&LlmCatalogSettings::default()).unwrap());
|
||||
for &provider in Provider::ALL {
|
||||
let catalog_info = Catalog::builtin()
|
||||
let catalog_info = catalog
|
||||
.default_for_provider(&provider.id())
|
||||
.cloned()
|
||||
.unwrap_or_else(|| panic!("no default model for {provider:?} in catalog"));
|
||||
|
|
@ -13,16 +18,24 @@ fn profile_context_window_matches_catalog_for_default_models() {
|
|||
.expect("catalog context window should be non-negative and fit in usize");
|
||||
|
||||
let profile: Box<dyn AgentProfile> = match provider {
|
||||
Provider::OpenAi => Box::new(OpenAiProfile::new(model)),
|
||||
Provider::OpenAi => {
|
||||
Box::new(OpenAiProfile::new(model).with_catalog(Arc::clone(&catalog)))
|
||||
}
|
||||
Provider::Kimi
|
||||
| Provider::Zai
|
||||
| Provider::Minimax
|
||||
| Provider::Inception
|
||||
| Provider::OpenAiCompatible => {
|
||||
Box::new(OpenAiProfile::new(model).with_provider(provider))
|
||||
| Provider::OpenAiCompatible => Box::new(
|
||||
OpenAiProfile::new(model)
|
||||
.with_provider(provider)
|
||||
.with_catalog(Arc::clone(&catalog)),
|
||||
),
|
||||
Provider::Gemini => {
|
||||
Box::new(GeminiProfile::new(model).with_catalog(Arc::clone(&catalog)))
|
||||
}
|
||||
Provider::Anthropic => {
|
||||
Box::new(AnthropicProfile::new(model).with_catalog(Arc::clone(&catalog)))
|
||||
}
|
||||
Provider::Gemini => Box::new(GeminiProfile::new(model)),
|
||||
Provider::Anthropic => Box::new(AnthropicProfile::new(model)),
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue