Skip to content

Commit

Permalink
Add settings for custom base url (#2594)
Browse files Browse the repository at this point in the history
* Add settings for custom base url and embedding dimension

Making the openai base url and embedding dimension configurable, these are useful to integrate AutoGPT with other models, like LLaMA

* Update to milvus.py to load the configuration also in the init_collection function

* Update radismem.py to get rid of Config() loading

* Update local.py to get rid of Config() loading

* Correct code format (python black)

* Revert DEFAULT_EMBED_DIM name to EMBED_DIM to keep tests  valid

* Better description for EMBED_DIM setting

* Set MockConfig to the type Config in Milvus test

* Fix formatting

* Update Milvus test, using Config() instead of building a mock config

* using the last milvus test code from main

* Remove embed_dim , no more needed after #4208

* Add example for OPENAI_BASE_URL

---------

Co-authored-by: Nicholas Tindle <nick@ntindle.com>
Co-authored-by: Reinier van der Leer <github@pwuts.nl>
Co-authored-by: merwanehamadi <merwanehamadi@gmail.com>
  • Loading branch information
4 people committed Jun 10, 2023
1 parent 3c51ff5 commit 6ff8478
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ OPENAI_API_KEY=your-openai-api-key
## PROMPT_SETTINGS_FILE - Specifies which Prompt Settings file to use (defaults to prompt_settings.yaml)
# PROMPT_SETTINGS_FILE=prompt_settings.yaml

## OPENAI_API_BASE_URL - Custom url for the OpenAI API, useful for connecting to custom backends. No effect if USE_AZURE is true, leave blank to keep the default url
# the following is an example:
# OPENAI_API_BASE_URL=http://localhost:443/v1

## AUTHORISE COMMAND KEY - Key to authorise commands
# AUTHORISE_COMMAND_KEY=y

Expand Down
2 changes: 2 additions & 0 deletions autogpt/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def __init__(self) -> None:
openai.api_type = self.openai_api_type
openai.api_base = self.openai_api_base
openai.api_version = self.openai_api_version
elif os.getenv("OPENAI_API_BASE_URL", None):
openai.api_base = os.getenv("OPENAI_API_BASE_URL")

if self.openai_organization is not None:
openai.organization = self.openai_organization
Expand Down

0 comments on commit 6ff8478

Please sign in to comment.