diff --git a/fern/docs/pages/manual/llms.mdx b/fern/docs/pages/manual/llms.mdx index 6dbb4a630..c9b88e3fb 100644 --- a/fern/docs/pages/manual/llms.mdx +++ b/fern/docs/pages/manual/llms.mdx @@ -38,6 +38,8 @@ llm: openai: api_key: # You could skip this configuration and use the OPENAI_API_KEY env var instead + model: # Optional model to use. Default is "gpt-3.5-turbo" + # Note: Open AI Models are listed here [here](https://platform.openai.com/docs/models) ``` And run PrivateGPT loading that profile you just created: diff --git a/private_gpt/components/llm/llm_component.py b/private_gpt/components/llm/llm_component.py index 34fd2fc2e..b9751e3a8 100644 --- a/private_gpt/components/llm/llm_component.py +++ b/private_gpt/components/llm/llm_component.py @@ -51,7 +51,9 @@ def __init__(self, settings: Settings) -> None: case "openai": from llama_index.llms import OpenAI - openai_settings = settings.openai.api_key - self.llm = OpenAI(api_key=openai_settings) + openai_settings = settings.openai + self.llm = OpenAI( + api_key=openai_settings.api_key, model=openai_settings.model + ) case "mock": self.llm = MockLLM() diff --git a/private_gpt/settings/settings.py b/private_gpt/settings/settings.py index 5d6310341..f4747d851 100644 --- a/private_gpt/settings/settings.py +++ b/private_gpt/settings/settings.py @@ -145,6 +145,10 @@ class SagemakerSettings(BaseModel): class OpenAISettings(BaseModel): api_key: str + model: str = Field( + "gpt-3.5-turbo", + description=("OpenAI Model to use. Example: 'gpt-4'."), + ) class UISettings(BaseModel): diff --git a/settings.yaml b/settings.yaml index 815ed09b8..036f5bd3e 100644 --- a/settings.yaml +++ b/settings.yaml @@ -49,3 +49,4 @@ sagemaker: openai: api_key: ${OPENAI_API_KEY:} + model: gpt-3.5-turbo \ No newline at end of file