chore: extraction model api (no proxying implemented yet)
This commit is contained in:
@@ -21,8 +21,6 @@ use secrecy::ExposeSecret;
|
||||
use serde::Deserialize;
|
||||
use serde_with::DeserializeFromStr;
|
||||
use serde_with::SerializeDisplay;
|
||||
use tokio::select;
|
||||
use tokio::time::sleep;
|
||||
use std::collections::VecDeque;
|
||||
use std::convert::Infallible;
|
||||
use std::fmt::Display;
|
||||
@@ -31,6 +29,8 @@ use std::time::Duration;
|
||||
use strum::EnumString;
|
||||
use strum::VariantArray;
|
||||
use tokio::runtime::Handle;
|
||||
use tokio::select;
|
||||
use tokio::time::sleep;
|
||||
|
||||
#[derive(Deserialize, TypedPath)]
|
||||
#[typed_path("/v1/chat/completions")]
|
||||
@@ -201,7 +201,6 @@ impl Shortcut {
|
||||
(P::OpenRouter, "poolside/laguna-s-2.1:free".into()),
|
||||
(P::VercelAiGateway, "stepfun/step-3.7-flash".into()),
|
||||
(P::VercelAiGateway, "inclusionai/ling-3.0-flash-fin".into()),
|
||||
|
||||
(
|
||||
P::VercelAiGateway,
|
||||
"inclusionai/ling-3.0-flash-sante".into(),
|
||||
@@ -259,7 +258,10 @@ impl Shortcut {
|
||||
(P::Ollama, "nemotron-3-ultra".into()),
|
||||
(P::NvidiaNim, "nvidia/nemotron-3-ultra-550b-a55b".into()),
|
||||
(P::Kilo, "nvidia-nemotron-3-ultra-550b-a55b-free".into()),
|
||||
(P::OpenRouter, "nvidia/nemotron-3-ultra-550b-a55b:free".into()),
|
||||
(
|
||||
P::OpenRouter,
|
||||
"nvidia/nemotron-3-ultra-550b-a55b:free".into(),
|
||||
),
|
||||
(P::OpenCode, "nemotron-3-ultra-free".into()),
|
||||
],
|
||||
|
||||
@@ -268,8 +270,14 @@ impl Shortcut {
|
||||
(P::HuggingFace, "zai-org/GLM-5.3".into()),
|
||||
(P::CloudflareWorkersAi, "@cf/zai-org/glm-5.3".into()),
|
||||
(P::Mistral, "zai-glm-5-3".into()),
|
||||
(P::VercelAiGateway, "deepseek/deepseek-v4.1-flash-1017".into()),
|
||||
(P::CloudflareWorkersAi, "@cf/deepseek-ai/deepseek-v4.1-flash-1017".into()),
|
||||
(
|
||||
P::VercelAiGateway,
|
||||
"deepseek/deepseek-v4.1-flash-1017".into(),
|
||||
),
|
||||
(
|
||||
P::CloudflareWorkersAi,
|
||||
"@cf/deepseek-ai/deepseek-v4.1-flash-1017".into(),
|
||||
),
|
||||
(P::OpenCode, "muse-spark-1.3-contributor-free".into()),
|
||||
(P::NvidiaNim, "moonshotai/kimi-k3".into()),
|
||||
(P::HuggingFace, "moonshotai/Kimi-K3".into()),
|
||||
|
||||
@@ -73,8 +73,10 @@ impl Shortcut {
|
||||
|
||||
match self {
|
||||
S::CodestralEmbed2505 => vec![(P::Mistral, "codestral-embed-2505".into())],
|
||||
S::CohereEmbedV4_0 => vec![(P::Cohere, "embed-v4.0".into()),
|
||||
(P::VercelAiGateway, "cohere/embed-v4.0".into())],
|
||||
S::CohereEmbedV4_0 => vec![
|
||||
(P::Cohere, "embed-v4.0".into()),
|
||||
(P::VercelAiGateway, "cohere/embed-v4.0".into()),
|
||||
],
|
||||
S::CohereEmbedV5_0Fast => vec![
|
||||
(P::Cohere, "embed-v5.0-fast".into()),
|
||||
(P::VercelAiGateway, "cohere/embed-v5.0-fast".into()),
|
||||
@@ -209,18 +211,22 @@ pub async fn create_embeddings(
|
||||
.build()
|
||||
})
|
||||
.collect(),
|
||||
Provider::VercelAiGateway => state
|
||||
.app_args
|
||||
.vercel_ai_gateway_api_key
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|api_key| {
|
||||
Upstream::builder()
|
||||
.url("https://ai-gateway.vercel.sh/v1/embeddings".parse().expect("TODO"))
|
||||
.api_key(api_key)
|
||||
.build()
|
||||
})
|
||||
.collect(),
|
||||
Provider::VercelAiGateway => state
|
||||
.app_args
|
||||
.vercel_ai_gateway_api_key
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|api_key| {
|
||||
Upstream::builder()
|
||||
.url(
|
||||
"https://ai-gateway.vercel.sh/v1/embeddings"
|
||||
.parse()
|
||||
.expect("TODO"),
|
||||
)
|
||||
.api_key(api_key)
|
||||
.build()
|
||||
})
|
||||
.collect(),
|
||||
};
|
||||
|
||||
if let Ok(upstreams) = Vec1::try_from(upstreams) {
|
||||
|
||||
@@ -12,8 +12,8 @@ use url::Url;
|
||||
|
||||
mod chat;
|
||||
mod decisions;
|
||||
mod frontend;
|
||||
mod embeddings;
|
||||
mod frontend;
|
||||
mod models;
|
||||
mod system_one;
|
||||
|
||||
|
||||
@@ -53,7 +53,10 @@ impl Shortcut {
|
||||
match self {
|
||||
S::S => {
|
||||
vec![
|
||||
(P::VercelAiGateway, "perplexity/pplx-decider-flash-v1.2".into()),
|
||||
(
|
||||
P::VercelAiGateway,
|
||||
"perplexity/pplx-decider-flash-v1.2".into(),
|
||||
),
|
||||
(P::LiquidAi, "d1:free".into()),
|
||||
(P::CloudflareWorkersAi, "clef-omni".into()),
|
||||
(P::CloudflareWorkersAi, "clef-flash".into()),
|
||||
@@ -74,9 +77,7 @@ impl Shortcut {
|
||||
}
|
||||
|
||||
S::L => {
|
||||
vec![
|
||||
(P::VercelAiGateway, "liquid/d1-ultra".into())
|
||||
]
|
||||
vec![(P::VercelAiGateway, "liquid/d1-ultra".into())]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user