mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-06-07 12:45:40 +00:00
Support base_api in the settings
This commit is contained in:
parent
9af1a29949
commit
64fe283abc
@ -186,10 +186,9 @@ async fn non_streamed_chat(
|
|||||||
if let Some(api_key) = chat_settings.api_key.as_ref() {
|
if let Some(api_key) = chat_settings.api_key.as_ref() {
|
||||||
config = config.with_api_key(api_key);
|
config = config.with_api_key(api_key);
|
||||||
}
|
}
|
||||||
// We cannot change the endpoint
|
if let Some(base_api) = chat_settings.base_api.as_ref() {
|
||||||
// if let Some(endpoint) = chat_settings.endpoint.as_ref() {
|
config = config.with_api_base(base_api);
|
||||||
// config.with_api_base(&endpoint);
|
}
|
||||||
// }
|
|
||||||
let client = Client::with_config(config);
|
let client = Client::with_config(config);
|
||||||
|
|
||||||
setup_search_tool(&mut chat_completion, &chat_settings.prompts);
|
setup_search_tool(&mut chat_completion, &chat_settings.prompts);
|
||||||
@ -257,10 +256,9 @@ async fn streamed_chat(
|
|||||||
if let Some(api_key) = chat_settings.api_key.as_ref() {
|
if let Some(api_key) = chat_settings.api_key.as_ref() {
|
||||||
config = config.with_api_key(api_key);
|
config = config.with_api_key(api_key);
|
||||||
}
|
}
|
||||||
// We cannot change the endpoint
|
if let Some(base_api) = chat_settings.base_api.as_ref() {
|
||||||
// if let Some(endpoint) = chat_settings.endpoint.as_ref() {
|
config = config.with_api_base(base_api);
|
||||||
// config.with_api_base(&endpoint);
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
setup_search_tool(&mut chat_completion, &chat_settings.prompts);
|
setup_search_tool(&mut chat_completion, &chat_settings.prompts);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ async fn patch_settings(
|
|||||||
#[serde(deny_unknown_fields, rename_all = "camelCase")]
|
#[serde(deny_unknown_fields, rename_all = "camelCase")]
|
||||||
pub struct ChatSettings {
|
pub struct ChatSettings {
|
||||||
pub source: String,
|
pub source: String,
|
||||||
pub endpoint: Option<String>,
|
pub base_api: Option<String>,
|
||||||
pub api_key: Option<String>,
|
pub api_key: Option<String>,
|
||||||
pub prompts: ChatPrompts,
|
pub prompts: ChatPrompts,
|
||||||
pub indexes: BTreeMap<String, ChatIndexSettings>,
|
pub indexes: BTreeMap<String, ChatIndexSettings>,
|
||||||
@ -95,7 +95,7 @@ impl Default for ChatSettings {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
ChatSettings {
|
ChatSettings {
|
||||||
source: "openai".to_string(),
|
source: "openai".to_string(),
|
||||||
endpoint: None,
|
base_api: None,
|
||||||
api_key: None,
|
api_key: None,
|
||||||
prompts: ChatPrompts {
|
prompts: ChatPrompts {
|
||||||
system: DEFAULT_SYSTEM_MESSAGE.to_string(),
|
system: DEFAULT_SYSTEM_MESSAGE.to_string(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user