mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-09-07 18:20:30 +00:00
feat: prompt_style applied to all LLMs + extra LLM params. (#1835)
* Updated prompt_style to be moved to the main LLM setting since all LLMs from llama_index can utilize this. I also included temperature, context window size, max_tokens, max_new_tokens into the openailike to help ensure the settings are consistent from the other implementations. * Removed prompt_style from llamacpp entirely * Fixed settings-local.yaml to include prompt_style in the LLM settings instead of llamacpp.
This commit is contained in:
@@ -51,7 +51,7 @@ class LLMComponent:
|
||||
"Local dependencies not found, install with `poetry install --extras llms-llama-cpp`"
|
||||
) from e
|
||||
|
||||
prompt_style = get_prompt_style(settings.llamacpp.prompt_style)
|
||||
prompt_style = get_prompt_style(settings.llm.prompt_style)
|
||||
settings_kwargs = {
|
||||
"tfs_z": settings.llamacpp.tfs_z, # ollama and llama-cpp
|
||||
"top_k": settings.llamacpp.top_k, # ollama and llama-cpp
|
||||
@@ -109,15 +109,20 @@ class LLMComponent:
|
||||
raise ImportError(
|
||||
"OpenAILike dependencies not found, install with `poetry install --extras llms-openai-like`"
|
||||
) from e
|
||||
|
||||
prompt_style = get_prompt_style(settings.llm.prompt_style)
|
||||
openai_settings = settings.openai
|
||||
self.llm = OpenAILike(
|
||||
api_base=openai_settings.api_base,
|
||||
api_key=openai_settings.api_key,
|
||||
model=openai_settings.model,
|
||||
is_chat_model=True,
|
||||
max_tokens=None,
|
||||
max_tokens=settings.llm.max_new_tokens,
|
||||
api_version="",
|
||||
temperature=settings.llm.temperature,
|
||||
context_window=settings.llm.context_window,
|
||||
max_new_tokens=settings.llm.max_new_tokens,
|
||||
messages_to_prompt=prompt_style.messages_to_prompt,
|
||||
completion_to_prompt=prompt_style.completion_to_prompt,
|
||||
)
|
||||
case "ollama":
|
||||
try:
|
||||
|
Reference in New Issue
Block a user