mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-09-23 12:07:12 +00:00
feat(llm - embed): Add support for Azure OpenAI (#1698)
* Add support for Azure OpenAI * fix: wrong default api_version Should be dashes instead of underscores. see: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference * fix: code styling applied "make check" changes * refactor: extend documentation * mention azopenai as available option and extras * add recommended section * include settings-azopenai.yaml configuration file * fix: documentation
This commit is contained in:
@@ -81,7 +81,9 @@ class DataSettings(BaseModel):
|
||||
|
||||
|
||||
class LLMSettings(BaseModel):
|
||||
mode: Literal["llamacpp", "openai", "openailike", "sagemaker", "mock", "ollama"]
|
||||
mode: Literal[
|
||||
"llamacpp", "openai", "openailike", "azopenai", "sagemaker", "mock", "ollama"
|
||||
]
|
||||
max_new_tokens: int = Field(
|
||||
256,
|
||||
description="The maximum number of token that the LLM is authorized to generate in one completion.",
|
||||
@@ -152,7 +154,7 @@ class HuggingFaceSettings(BaseModel):
|
||||
|
||||
|
||||
class EmbeddingSettings(BaseModel):
|
||||
mode: Literal["huggingface", "openai", "sagemaker", "ollama", "mock"]
|
||||
mode: Literal["huggingface", "openai", "azopenai", "sagemaker", "ollama", "mock"]
|
||||
ingest_mode: Literal["simple", "batch", "parallel"] = Field(
|
||||
"simple",
|
||||
description=(
|
||||
@@ -239,6 +241,25 @@ class OllamaSettings(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class AzureOpenAISettings(BaseModel):
|
||||
api_key: str
|
||||
azure_endpoint: str
|
||||
api_version: str = Field(
|
||||
"2023_05_15",
|
||||
description="The API version to use for this operation. This follows the YYYY-MM-DD format.",
|
||||
)
|
||||
embedding_deployment_name: str
|
||||
embedding_model: str = Field(
|
||||
"text-embedding-ada-002",
|
||||
description="OpenAI Model to use. Example: 'text-embedding-ada-002'.",
|
||||
)
|
||||
llm_deployment_name: str
|
||||
llm_model: str = Field(
|
||||
"gpt-35-turbo",
|
||||
description="OpenAI Model to use. Example: 'gpt-4'.",
|
||||
)
|
||||
|
||||
|
||||
class UISettings(BaseModel):
|
||||
enabled: bool
|
||||
path: str
|
||||
@@ -349,6 +370,7 @@ class Settings(BaseModel):
|
||||
sagemaker: SagemakerSettings
|
||||
openai: OpenAISettings
|
||||
ollama: OllamaSettings
|
||||
azopenai: AzureOpenAISettings
|
||||
vectorstore: VectorstoreSettings
|
||||
nodestore: NodeStoreSettings
|
||||
qdrant: QdrantSettings | None = None
|
||||
|
Reference in New Issue
Block a user