mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-06-25 15:01:52 +00:00
Allow setting OpenAI model in settings (#1386)
feat(settings): Allow setting openai model to be used. Default to GPT 3.5
This commit is contained in:
parent
a3ed14c58f
commit
a072a40a7c
@ -38,6 +38,8 @@ llm:
|
|||||||
|
|
||||||
openai:
|
openai:
|
||||||
api_key: <your_openai_api_key> # You could skip this configuration and use the OPENAI_API_KEY env var instead
|
api_key: <your_openai_api_key> # You could skip this configuration and use the OPENAI_API_KEY env var instead
|
||||||
|
model: <openai_model_to_use> # 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:
|
And run PrivateGPT loading that profile you just created:
|
||||||
|
@ -50,7 +50,9 @@ class LLMComponent:
|
|||||||
case "openai":
|
case "openai":
|
||||||
from llama_index.llms import OpenAI
|
from llama_index.llms import OpenAI
|
||||||
|
|
||||||
openai_settings = settings.openai.api_key
|
openai_settings = settings.openai
|
||||||
self.llm = OpenAI(api_key=openai_settings)
|
self.llm = OpenAI(
|
||||||
|
api_key=openai_settings.api_key, model=openai_settings.model
|
||||||
|
)
|
||||||
case "mock":
|
case "mock":
|
||||||
self.llm = MockLLM()
|
self.llm = MockLLM()
|
||||||
|
@ -145,6 +145,10 @@ class SagemakerSettings(BaseModel):
|
|||||||
|
|
||||||
class OpenAISettings(BaseModel):
|
class OpenAISettings(BaseModel):
|
||||||
api_key: str
|
api_key: str
|
||||||
|
model: str = Field(
|
||||||
|
"gpt-3.5-turbo",
|
||||||
|
description=("OpenAI Model to use. Example: 'gpt-4'."),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class UISettings(BaseModel):
|
class UISettings(BaseModel):
|
||||||
|
@ -49,3 +49,4 @@ sagemaker:
|
|||||||
|
|
||||||
openai:
|
openai:
|
||||||
api_key: ${OPENAI_API_KEY:}
|
api_key: ${OPENAI_API_KEY:}
|
||||||
|
model: gpt-3.5-turbo
|
Loading…
Reference in New Issue
Block a user