Skip to content
New issue

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

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

Already on GitHub? # to your account

Better .env with more settings #20

Merged
merged 2 commits into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions example.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# DIRECTORY SETTINGS #

PERSIST_DIRECTORY=db
DOCUMENTS_DIRECTORY=source_documents
LLAMA_EMBEDDINGS_MODEL=models/ggml-model-q4_0.bin

# LLM MODEL SETTINGS #

# Your LLM type (GPT4All or LlamaCpp)
MODEL_TYPE=GPT4All

# Absolute path to your llama supported embeddings model.
LLAMA_EMBEDDINGS_MODEL=models/ggml-model-q4_0.bin

# Absolute path to your GPT4All or LlamaCpp model
MODEL_PATH=models/ggml-gpt4all-j-v1.3-groovy.bin
MODEL_N_CTX=1000

# Context size for both the vector datbase and the llm seperately in one value
# Double this value if you are getting context size errors
MODEL_N_CTX=1024
# Temperature range of 0=Logical to 1=Creative
MODEL_TEMP=0.8

# Stop based on certain characters or strings.
# \n is for new lines and \t is for tabs.
MODEL_STOP=\n,\t
4 changes: 3 additions & 1 deletion startLLM.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
model_type = os.environ.get('MODEL_TYPE')
model_path = os.environ.get('MODEL_PATH')
model_n_ctx = os.environ.get('MODEL_N_CTX')
model_temp = os.environ.get('MODEL_TEMP')
model_stop = os.environ.get('MODEL_STOP').split(",")

def main():
# Load stored vectorstore
Expand All @@ -32,7 +34,7 @@ def main():
match model_type:
case "LlamaCpp":
from langchain.llms import LlamaCpp
llm = LlamaCpp(model_path=local_path, n_ctx=model_n_ctx, callbacks=callbacks, verbose=True)
llm = LlamaCpp(model_path=local_path, n_ctx=model_n_ctx, temperature=model_temp, stop=model_stop, callbacks=callbacks, verbose=True)
case "GPT4All":
from langchain.llms import GPT4All
llm = GPT4All(model=local_path, n_ctx=model_n_ctx, callbacks=callbacks, verbose=True, backend='gptj')
Expand Down