-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from alkem-io/threaded-interactions-issue-25
Threaded interactions
- Loading branch information
Showing
9 changed files
with
743 additions
and
690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
import os | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
config = { | ||
"db_host": os.getenv('VECTOR_DB_HOST'), | ||
"db_port": os.getenv('VECTOR_DB_PORT'), | ||
"llm_deployment_name": os.getenv('LLM_DEPLOYMENT_NAME'), | ||
"model_temperature": os.getenv('AI_MODEL_TEMPERATURE'), | ||
"embeddings_deployment_name": os.getenv('EMBEDDINGS_DEPLOYMENT_NAME'), | ||
"openai_endpoint": os.getenv('AZURE_OPENAI_ENDPOINT'), | ||
"openai_api_key": os.getenv('AZURE_OPENAI_API_KEY'), | ||
"openai_api_version": os.getenv('OPENAI_API_VERSION'), | ||
"rabbitmq_host": os.getenv('RABBITMQ_HOST'), | ||
"rabbitmq_user": os.getenv('RABBITMQ_USER'), | ||
"rabbitmq_password": os.getenv('RABBITMQ_PASSWORD'), | ||
"rabbitmq_queue": os.getenv('RABBITMQ_QUEUE'), | ||
"source_website": os.getenv('AI_SOURCE_WEBSITE'), | ||
"local_path": os.getenv('AI_LOCAL_PATH') or '' | ||
"db_host": os.getenv("VECTOR_DB_HOST"), | ||
"db_port": os.getenv("VECTOR_DB_PORT"), | ||
"llm_deployment_name": os.getenv("LLM_DEPLOYMENT_NAME"), | ||
"model_temperature": os.getenv("AI_MODEL_TEMPERATURE"), | ||
"embeddings_deployment_name": os.getenv("EMBEDDINGS_DEPLOYMENT_NAME"), | ||
"openai_endpoint": os.getenv("AZURE_OPENAI_ENDPOINT"), | ||
"openai_api_key": os.getenv("AZURE_OPENAI_API_KEY"), | ||
"openai_api_version": os.getenv("OPENAI_API_VERSION"), | ||
"rabbitmq_host": os.getenv("RABBITMQ_HOST"), | ||
"rabbitmq_user": os.getenv("RABBITMQ_USER"), | ||
"rabbitmq_password": os.getenv("RABBITMQ_PASSWORD"), | ||
"rabbitmq_queue": os.getenv("RABBITMQ_QUEUE"), | ||
"source_website": os.getenv("AI_SOURCE_WEBSITE"), | ||
"local_path": os.getenv("AI_LOCAL_PATH") or "", | ||
"history_length": int(os.getenv("HISTORY_LENGTH") or "10"), | ||
} | ||
|
||
local_path = config['local_path'] | ||
vectordb_path = local_path + os.sep + 'vectordb' | ||
local_path = config["local_path"] | ||
vectordb_path = local_path + os.sep + "vectordb" | ||
|
||
chunk_size = 3000 | ||
# token limit for for the completion of the chat model, this does not include the overall context length | ||
max_token_limit = 2000 | ||
|
||
LOG_LEVEL = os.getenv('LOG_LEVEL') # Possible values: 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL' | ||
assert LOG_LEVEL in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] | ||
LOG_LEVEL = os.getenv( | ||
"LOG_LEVEL" | ||
) # Possible values: 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL' | ||
assert LOG_LEVEL in ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from langchain_openai import AzureChatOpenAI, AzureOpenAI | ||
from chromadb.utils.embedding_functions import OpenAIEmbeddingFunction | ||
from config import config, LOG_LEVEL, max_token_limit | ||
|
||
# verbose output for LLMs | ||
if LOG_LEVEL == "DEBUG": | ||
verbose_models = True | ||
else: | ||
verbose_models = False | ||
|
||
|
||
chat_llm = AzureChatOpenAI( | ||
azure_deployment=config["llm_deployment_name"], | ||
temperature=float(config["model_temperature"]), | ||
max_tokens=max_token_limit, | ||
verbose=verbose_models, | ||
) | ||
|
||
condenser_llm = AzureChatOpenAI( | ||
azure_deployment=config["llm_deployment_name"], | ||
temperature=0, | ||
max_tokens=max_token_limit, | ||
verbose=verbose_models, | ||
) | ||
|
||
embed_func = OpenAIEmbeddingFunction( | ||
api_key=config["openai_api_key"], | ||
api_base=config["openai_endpoint"], | ||
api_type="azure", | ||
api_version=config["openai_api_version"], | ||
model_name=config["embeddings_deployment_name"], | ||
) |
Oops, something went wrong.