Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add settings for custom base url #2594

Merged
merged 35 commits into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
da2d348
Add settings for custom base url and embedding dimension
DGdev91 Apr 19, 2023
b349f21
Merge branch 'master' into master
DGdev91 Apr 19, 2023
96e7650
Merge branch 'master' into master
ntindle Apr 24, 2023
04f6ffd
Merge branch 'Significant-Gravitas:master' into master
DGdev91 Apr 24, 2023
b7defd2
Update to milvus.py to load the configuration also in the init_collec…
DGdev91 Apr 24, 2023
f99269b
Merge branch 'master' into master
DGdev91 Apr 25, 2023
3eafdc1
Merge branch 'master' into master
ntindle Apr 27, 2023
cf5b45a
Update radismem.py to get rid of Config() loading
DGdev91 Apr 27, 2023
9a59b86
Update local.py to get rid of Config() loading
DGdev91 Apr 27, 2023
47e1516
Correct code format (python black)
DGdev91 Apr 27, 2023
56f77cc
Revert DEFAULT_EMBED_DIM name to EMBED_DIM to keep tests valid
DGdev91 Apr 27, 2023
4fc4895
Better description for EMBED_DIM setting
DGdev91 Apr 27, 2023
2072f64
Merge branch 'master' into master
DGdev91 Apr 27, 2023
09dbc71
Merge branch 'master' into master
ntindle Apr 27, 2023
1562deb
Set MockConfig to the type Config in Milvus test
DGdev91 Apr 30, 2023
0e7ec92
Fix formatting
DGdev91 Apr 30, 2023
f977d2f
Merge branch 'master' into master
DGdev91 Apr 30, 2023
4bb9db1
Merge branch 'master' into master
ntindle Apr 30, 2023
b27874a
Merge branch 'master' into master
DGdev91 May 3, 2023
2445a2f
Update Milvus test, using Config() instead of building a mock config
DGdev91 May 3, 2023
bb48512
Merge branch 'master' into master
DGdev91 May 5, 2023
1f99590
Merge branch 'master' into master
DGdev91 May 12, 2023
9fbf4a1
using the last milvus test code from main
DGdev91 May 13, 2023
f8f3631
Merge branch 'master' into master
DGdev91 May 13, 2023
e00cacd
Merge remote-tracking branch 'Significant-Gravitas/master'
DGdev91 May 25, 2023
f20fc0d
Remove embed_dim , no more needed after #4208
DGdev91 May 25, 2023
5cd9df3
Merge branch 'master' into master
DGdev91 May 31, 2023
8e4ad31
Merge branch 'master' into master
Pwuts Jun 7, 2023
4e871fb
Add example for OPENAI_BASE_URL
DGdev91 Jun 7, 2023
08eb93b
Merge branch 'master' into master
Pwuts Jun 9, 2023
2c73a1c
Merge branch 'master' into master
Pwuts Jun 9, 2023
c38a035
Merge branch 'master' into master
Pwuts Jun 9, 2023
1e41080
Merge branch 'master' into master
waynehamadi Jun 9, 2023
86eff79
Merge branch 'master' into master
Pwuts Jun 10, 2023
0d3060e
Merge branch 'master' into master
Pwuts Jun 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
## AI_SETTINGS_FILE - Specifies which AI Settings file to use (defaults to ai_settings.yaml)
# AI_SETTINGS_FILE=ai_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
Pwuts marked this conversation as resolved.
Show resolved Hide resolved
# OPENAI_API_BASE_URL=
DGdev91 marked this conversation as resolved.
Show resolved Hide resolved

## EMBED_DIM - Define the embedding vector size, useful for models. OpenAI: 1536 (default), LLaMA 7B: 4096, LLaMA 13B: 5120, LLaMA 33B: 6656, LLaMA 65B: 8192 (Default: 1536)
# EMBED_DIM=1536
ntindle marked this conversation as resolved.
Show resolved Hide resolved

################################################################################
### LLM PROVIDER
################################################################################
Expand Down
3 changes: 3 additions & 0 deletions autogpt/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self) -> None:
self.browse_spacy_language_model = os.getenv(
"BROWSE_SPACY_LANGUAGE_MODEL", "en_core_web_sm"
)
ntindle marked this conversation as resolved.
Show resolved Hide resolved
self.embed_dim = int(os.getenv("EMBED_DIM", 1536))

self.openai_api_key = os.getenv("OPENAI_API_KEY")
self.temperature = float(os.getenv("TEMPERATURE", "0"))
Expand All @@ -51,6 +52,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")
ntindle marked this conversation as resolved.
Show resolved Hide resolved

self.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY")
self.elevenlabs_voice_1_id = os.getenv("ELEVENLABS_VOICE_1_ID")
Expand Down
4 changes: 3 additions & 1 deletion autogpt/memory/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import numpy as np
import orjson

from autogpt.config import Config
from autogpt.llm_utils import create_embedding_with_ada
from autogpt.memory.base import MemoryProviderSingleton

EMBED_DIM = 1536
CFG = Config()
DGdev91 marked this conversation as resolved.
Show resolved Hide resolved
EMBED_DIM = CFG.embed_dim
SAVE_OPTIONS = orjson.OPT_SERIALIZE_NUMPY | orjson.OPT_SERIALIZE_DATACLASS


Expand Down
2 changes: 1 addition & 1 deletion autogpt/memory/milvus.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, cfg) -> None:
connections.connect(address=cfg.milvus_addr)
fields = [
FieldSchema(name="pk", dtype=DataType.INT64, is_primary=True, auto_id=True),
FieldSchema(name="embeddings", dtype=DataType.FLOAT_VECTOR, dim=1536),
FieldSchema(name="embeddings", dtype=DataType.FLOAT_VECTOR, dim=cfg.embed_dim),
FieldSchema(name="raw_text", dtype=DataType.VARCHAR, max_length=65535),
]

Expand Down
2 changes: 1 addition & 1 deletion autogpt/memory/pinecone.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, cfg):
pinecone_api_key = cfg.pinecone_api_key
pinecone_region = cfg.pinecone_region
pinecone.init(api_key=pinecone_api_key, environment=pinecone_region)
dimension = 1536
dimension = cfg.embed_dim
metric = "cosine"
pod_type = "p1"
table_name = "auto-gpt"
Expand Down
6 changes: 4 additions & 2 deletions autogpt/memory/redismem.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
from redis.commands.search.indexDefinition import IndexDefinition, IndexType
from redis.commands.search.query import Query

from autogpt.config import Config
from autogpt.llm_utils import create_embedding_with_ada
from autogpt.logs import logger
from autogpt.memory.base import MemoryProviderSingleton

DGdev91 marked this conversation as resolved.
Show resolved Hide resolved
CFG = Config()
SCHEMA = [
TextField("data"),
VectorField(
"embedding",
"HNSW",
{"TYPE": "FLOAT32", "DIM": 1536, "DISTANCE_METRIC": "COSINE"},
{"TYPE": "FLOAT32", "DIM": CFG.embed_dim, "DISTANCE_METRIC": "COSINE"},
),
DGdev91 marked this conversation as resolved.
Show resolved Hide resolved
]

Expand All @@ -37,7 +39,7 @@ def __init__(self, cfg):
redis_host = cfg.redis_host
redis_port = cfg.redis_port
redis_password = cfg.redis_password
self.dimension = 1536
self.dimension = cfg.embed_dim
self.redis = redis.Redis(
host=redis_host,
port=redis_port,
Expand Down