From 11f0d719f5f9c8b78dd94648936473a9cb721358 Mon Sep 17 00:00:00 2001 From: Sidharth Mohanty Date: Sat, 23 Dec 2023 14:42:18 +0530 Subject: [PATCH] Provide openai-key support from config (#1052) --- .devcontainer/devcontainer.json | 33 ------------------- docs/api-reference/advanced/configuration.mdx | 16 ++++++--- embedchain/config/embedder/base.py | 5 ++- embedchain/config/llm/base.py | 2 ++ embedchain/embedder/openai.py | 6 ++-- embedchain/llm/openai.py | 6 ++-- embedchain/utils.py | 3 ++ pyproject.toml | 2 +- tests/llm/test_openai.py | 1 + 9 files changed, 31 insertions(+), 43 deletions(-) delete mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 65e5dd09..00000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "Python 3", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye", - "customizations": { - "codespaces": { - "openFiles": [ - "README.md", - "examples/chat-pdf/app.py" - ] - }, - "vscode": { - "settings": {}, - "extensions": [ - "ms-python.python", - "ms-python.vscode-pylance" - ] - } - }, - "updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y ", diff --git a/tests/llm/test_openai.py b/tests/llm/test_openai.py index 370a310a..73a3146a 100644 --- a/tests/llm/test_openai.py +++ b/tests/llm/test_openai.py @@ -72,4 +72,5 @@ def test_get_llm_model_answer_without_system_prompt(config, mocker): temperature=config.temperature, max_tokens=config.max_tokens, model_kwargs={"top_p": config.top_p}, + api_key=os.environ["OPENAI_API_KEY"], )