Skip to content

Commit e61e83a

Browse files
committed
renaming CustomLlm to ApiType
Signed-off-by: Aminu Oluwaseun Joshua <[email protected]>
1 parent 334f8e4 commit e61e83a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

crates/factor-llm/src/spin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::path::PathBuf;
22
use std::sync::Arc;
33

44
use spin_factors::runtime_config::toml::GetTomlValue;
5-
use spin_llm_remote_http::{CustomLlm, RemoteHttpLlmEngine};
5+
use spin_llm_remote_http::{ApiType, RemoteHttpLlmEngine};
66
use spin_world::async_trait;
77
use spin_world::v1::llm::{self as v1};
88
use spin_world::v2::llm::{self as v2};
@@ -122,7 +122,7 @@ impl LlmCompute {
122122
LlmCompute::RemoteHttp(config) => Arc::new(Mutex::new(RemoteHttpLlmEngine::new(
123123
config.url,
124124
config.auth_token,
125-
config.custom_llm,
125+
config.api_type,
126126
))),
127127
};
128128
Ok(engine)
@@ -134,7 +134,7 @@ pub struct RemoteHttpCompute {
134134
url: Url,
135135
auth_token: String,
136136
#[serde(default)]
137-
custom_llm: CustomLlm,
137+
api_type: ApiType,
138138
}
139139

140140
/// A noop engine used when the local engine feature is disabled.

crates/llm-remote-http/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ pub struct RemoteHttpLlmEngine {
1717
}
1818

1919
impl RemoteHttpLlmEngine {
20-
pub fn new(url: Url, auth_token: String, custom_llm: CustomLlm) -> Self {
21-
let worker: Box<dyn LlmWorker> = match custom_llm {
22-
CustomLlm::OpenAi => Box::new(open_ai::OpenAIAgentEngine::new(auth_token, url, None)),
23-
CustomLlm::Default => Box::new(default::DefaultAgentEngine::new(auth_token, url, None)),
20+
pub fn new(url: Url, auth_token: String, api_type: ApiType) -> Self {
21+
let worker: Box<dyn LlmWorker> = match api_type {
22+
ApiType::OpenAi => Box::new(open_ai::OpenAIAgentEngine::new(auth_token, url, None)),
23+
ApiType::Default => Box::new(default::DefaultAgentEngine::new(auth_token, url, None)),
2424
};
2525
Self { worker }
2626
}
@@ -214,7 +214,7 @@ impl From<CreateEmbeddingResponse> for wasi_llm::EmbeddingsResult {
214214

215215
#[derive(Debug, Default, serde::Deserialize, PartialEq)]
216216
#[serde(rename_all = "snake_case")]
217-
pub enum CustomLlm {
217+
pub enum ApiType {
218218
/// Compatible with OpenAI's API alongside some other LLMs
219219
OpenAi,
220220
#[default]

examples/open-ai-rust/runtime-config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
type = "remote_http"
33
url = "http://localhost:11434"
44
auth_token = "your-secret-token"
5-
custom_llm = "open_ai"
5+
api_type = "open_ai"

0 commit comments

Comments
 (0)