ollama兼容

This commit is contained in:
glide-the 2024-05-20 10:46:27 +08:00
parent 0470b8ae41
commit 2bb24d8b6d
6 changed files with 10 additions and 7 deletions

View File

@ -31,7 +31,7 @@ ollama:
- model: 'llama3' - model: 'llama3'
model_type: 'llm' model_type: 'llm'
model_credentials: model_credentials:
base_url: 'http://172.21.80.1:11434' base_url: 'http://172.21.192.1:11434'
mode: 'completion' mode: 'completion'

View File

@ -70,7 +70,7 @@ ollama:
- model: 'llama3' - model: 'llama3'
model_type: 'llm' model_type: 'llm'
model_credentials: model_credentials:
base_url: 'http://172.21.80.1:11434/v1' base_url: 'http://172.21.192.1:11434/v1'
``` ```

View File

@ -652,13 +652,16 @@ class OllamaLargeLanguageModel(_CommonOllama, LargeLanguageModel):
if user: if user:
extra_model_kwargs["user"] = user extra_model_kwargs["user"] = user
extra_body = {
**model_parameters,
**extra_model_kwargs,
}
# chat model # chat model
response = client.chat.completions.create( response = client.chat.completions.create(
messages=[self._convert_prompt_message_to_dict(m) for m in prompt_messages], messages=[self._convert_prompt_message_to_dict(m) for m in prompt_messages],
model=model, model=model,
stream=stream, stream=stream,
**model_parameters, extra_body=extra_body
**extra_model_kwargs,
) )
if stream: if stream:

View File

@ -4,7 +4,7 @@ ollama:
- model: 'llama3' - model: 'llama3'
model_type: 'llm' model_type: 'llm'
model_credentials: model_credentials:
base_url: 'http://172.21.80.1:11434/v1' base_url: 'http://172.21.192.1:11434/v1'

View File

@ -4,7 +4,7 @@ ollama:
- model: 'llama3' - model: 'llama3'
model_type: 'llm' model_type: 'llm'
model_credentials: model_credentials:
openai_api_base: 'http://172.21.80.1:11434' openai_api_base: 'http://172.21.192.1:11434'

View File

@ -4,7 +4,7 @@ ollama:
- model: 'llama3' - model: 'llama3'
model_type: 'llm' model_type: 'llm'
model_credentials: model_credentials:
base_url: 'http://172.21.80.1:11434/v1' base_url: 'http://172.21.192.1:11434/v1'