mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Parse ollama URL to adapt configuration depending on the endpoint
This commit is contained in:
parent
45f289488d
commit
8b1fcfd7f8
2 changed files with 42 additions and 16 deletions
|
@ -67,7 +67,7 @@ pub enum EmbedErrorKind {
|
|||
#[error("could not authenticate against {embedding} server{server_reply}{hint}", embedding=match *.1 {
|
||||
ConfigurationSource::User => "embedding",
|
||||
ConfigurationSource::OpenAi => "OpenAI",
|
||||
ConfigurationSource::Ollama => "ollama"
|
||||
ConfigurationSource::Ollama => "Ollama"
|
||||
},
|
||||
server_reply=option_info(.0.as_deref(), "server replied with "),
|
||||
hint=match *.1 {
|
||||
|
@ -306,6 +306,10 @@ impl NewEmbedderError {
|
|||
fault: FaultSource::User,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn ollama_unsupported_url(url: String) -> NewEmbedderError {
|
||||
Self { kind: NewEmbedderErrorKind::OllamaUnsupportedUrl(url), fault: FaultSource::User }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
|
@ -369,6 +373,8 @@ pub enum NewEmbedderErrorKind {
|
|||
LoadModel(candle_core::Error),
|
||||
#[error("{0}")]
|
||||
CouldNotParseTemplate(String),
|
||||
#[error("unsupported Ollama URL.\n - For `ollama` sources, the URL must end with `/api/embed` or `/api/embeddings`\n - Got `{0}`")]
|
||||
OllamaUnsupportedUrl(String),
|
||||
}
|
||||
|
||||
pub struct PossibleEmbeddingMistakes {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue