diff --git a/extensions/openai/completions.py b/extensions/openai/completions.py index 9ea6b232..40a4cab6 100644 --- a/extensions/openai/completions.py +++ b/extensions/openai/completions.py @@ -204,8 +204,9 @@ def chat_completions_common(body: dict, is_legacy: bool = False, stream=False) - name1_instruct, name2_instruct, _, _, context_instruct, turn_template, system_message = load_character_memoized(instruction_template, '', '', instruct=True) name1_instruct = body['name1_instruct'] or name1_instruct name2_instruct = body['name2_instruct'] or name2_instruct - context_instruct = body['context_instruct'] or context_instruct turn_template = body['turn_template'] or turn_template + context_instruct = body['context_instruct'] or context_instruct + system_message = body['system_message'] or system_message # Chat character character = body['character'] or shared.settings['character'] diff --git a/extensions/openai/embeddings.py b/extensions/openai/embeddings.py index a5b52d7b..396a3476 100644 --- a/extensions/openai/embeddings.py +++ b/extensions/openai/embeddings.py @@ -3,9 +3,8 @@ import os import numpy as np from extensions.openai.errors import ServiceUnavailableError from extensions.openai.utils import debug_msg, float_list_to_base64 -from transformers import AutoModel - from modules import shared +from transformers import AutoModel embeddings_params_initialized = False diff --git a/extensions/openai/typing.py b/extensions/openai/typing.py index e03358d8..afd57eab 100644 --- a/extensions/openai/typing.py +++ b/extensions/openai/typing.py @@ -42,7 +42,7 @@ class GenerationOptions(BaseModel): class CompletionRequestParams(BaseModel): - model: str | None = None + model: str | None = Field(default=None, description="Unused parameter. To change the model, use the /v1/internal/model/load endpoint.") prompt: str | List[str] best_of: int | None = Field(default=1, description="Unused parameter.") echo: bool | None = False @@ -75,7 +75,7 @@ class CompletionResponse(BaseModel): class ChatCompletionRequestParams(BaseModel): messages: List[dict] - model: str | None = None + model: str | None = Field(default=None, description="Unused parameter. To change the model, use the /v1/internal/model/load endpoint.") frequency_penalty: float | None = 0 function_call: str | dict | None = Field(default=None, description="Unused parameter.") functions: List[dict] | None = Field(default=None, description="Unused parameter.") @@ -92,10 +92,11 @@ class ChatCompletionRequestParams(BaseModel): mode: str = Field(default='instruct', description="Valid options: instruct, chat, chat-instruct.") instruction_template: str | None = Field(default=None, description="An instruction template defined under text-generation-webui/instruction-templates. If not set, the correct template will be guessed using the regex expressions in models/config.yaml.") + turn_template: str | None = Field(default=None, description="Overwrites the value set by instruction_template.") name1_instruct: str | None = Field(default=None, description="Overwrites the value set by instruction_template.") name2_instruct: str | None = Field(default=None, description="Overwrites the value set by instruction_template.") context_instruct: str | None = Field(default=None, description="Overwrites the value set by instruction_template.") - turn_template: str | None = Field(default=None, description="Overwrites the value set by instruction_template.") + system_message: str | None = Field(default=None, description="Overwrites the value set by instruction_template.") character: str | None = Field(default=None, description="A character defined under text-generation-webui/characters. If not set, the default \"Assistant\" character will be used.") name1: str | None = Field(default=None, description="Overwrites the value set by character.")