Skip to content

Commit

Permalink
chore: fix up test imports
Browse files Browse the repository at this point in the history
  • Loading branch information
lpm0073 committed Nov 19, 2023
1 parent b00886c commit 64c0ec7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ api-activate:
pip install -r requirements.txt

api-test:
cd ./api/terraform/python/openai_text/openai_text/ && \
pytest -v -s tests/
cd ./api/terraform/python/lambda_langchain/ && pytest -v -s tests/
cd ../../../..
cd ./api/terraform/python/lambda_openai_v2/ && pytest -v -s tests/
cd ../../../..
cd ./api/terraform/python/lambda_openai/ && pytest -v -s tests/
cd ../../../..

api-lint:
venv/bin/python3 -m pylint api/terraform/python/lambda_langchain/lambda_handler.py && \
Expand Down
16 changes: 16 additions & 0 deletions api/terraform/python/lambda_openai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
"""Lambda function for OpenAI API."""
import os

from dotenv import find_dotenv, load_dotenv


# Load environment variables from .env file in all folders
dotenv_path = find_dotenv()
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path=dotenv_path, verbose=True)
OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
OPENAI_API_ORGANIZATION = os.environ["OPENAI_API_ORGANIZATION"]
PINECONE_API_KEY = os.environ["PINECONE_API_KEY"]
else:
raise FileNotFoundError("No .env file found in root directory of repository")
17 changes: 17 additions & 0 deletions api/terraform/python/lambda_openai_v2/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# pylint: disable=duplicate-code
"""Lambda function for OpenAI API."""
import os

from dotenv import find_dotenv, load_dotenv


# Load environment variables from .env file in all folders
dotenv_path = find_dotenv()
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path=dotenv_path, verbose=True)
OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
OPENAI_API_ORGANIZATION = os.environ["OPENAI_API_ORGANIZATION"]
PINECONE_API_KEY = os.environ["PINECONE_API_KEY"]
else:
raise FileNotFoundError("No .env file found in root directory of repository")
1 change: 1 addition & 0 deletions api/terraform/python/lambda_openai_v2/tests/test_01.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# flake8: noqa: F401
# pylint: disable=R0801
# pylint: disable=duplicate-code
"""
Test requests to the OpenAI API using the Lambda Layer, 'genai'.
"""
Expand Down

0 comments on commit 64c0ec7

Please sign in to comment.