@@ -10,6 +10,23 @@ inputs:
10
10
description : ' The version of Python to use, such as 3.11.0'
11
11
required : true
12
12
type : string
13
+ openai-api-organization :
14
+ description : ' The OpenAI API organization'
15
+ required : true
16
+ type : string
17
+ openai-api-key :
18
+ description : ' The OpenAI API key'
19
+ required : true
20
+ type : string
21
+ pinecone-api-key :
22
+ description : ' The Pinecone API key'
23
+ required : true
24
+ type : string
25
+ pinecone-environment :
26
+ description : ' The Pinecone environment'
27
+ required : true
28
+ type : string
29
+
13
30
env :
14
31
REQUIREMENTS_PATH : ' api/terraform/python/layer_genai/requirements.txt'
15
32
@@ -20,60 +37,32 @@ runs:
20
37
id : checkout
21
38
uses : actions/checkout@v4
22
39
23
- - name : Verify OPENAI_API_ORGANIZATION
24
- shell : bash
25
- run : |
26
- if [[ -z "${{ secrets.OPENAI_API_ORGANIZATION }}" ]]; then
27
- echo "OPENAI_API_ORGANIZATION is not set" >&2
28
- exit 1
29
- fi
30
-
31
- - name : Verify OPENAI_API_KEY
32
- shell : bash
33
- run : |
34
- if [[ -z "${{ secrets.OPENAI_API_KEY }}" ]]; then
35
- echo "OPENAI_API_KEY is not set" >&2
36
- exit 1
37
- fi
38
-
39
- - name : Verify PINECONE_API_KEY
40
- shell : bash
41
- run : |
42
- if [[ -z "${{ secrets.PINECONE_API_KEY }}" ]]; then
43
- echo "PINECONE_API_KEY is not set" >&2
44
- exit 1
45
- fi
46
-
47
- - name : Verify PINECONE_ENVIRONMENT
48
- shell : bash
49
- run : |
50
- if [[ -z "${{ secrets.PINECONE_ENVIRONMENT }}" ]]; then
51
- echo "PINECONE_ENVIRONMENT is not set" >&2
52
- exit 1
53
- fi
54
-
55
40
- name : Check for openai in requirements
41
+ shell : bash
56
42
run : |
57
43
if ! grep -q "openai" ./requirements.txt; then
58
44
echo "openai not found in requirements.txt" >&2
59
45
exit 1
60
46
fi
61
47
62
48
- name : Check for langchain in requirements
49
+ shell : bash
63
50
run : |
64
51
if ! grep -q "langchain" ./requirements.txt; then
65
52
echo "langchain not found in requirements.txt" >&2
66
53
exit 1
67
54
fi
68
55
69
56
- name : Check for langchain-experimental in requirements
57
+ shell : bash
70
58
run : |
71
59
if ! grep -q "langchain-experimental" ./requirements.txt; then
72
60
echo "langchain-experimental not found in requirements.txt" >&2
73
61
exit 1
74
62
fi
75
63
76
64
- name : Check for pinecone-client in requirements
65
+ shell : bash
77
66
run : |
78
67
if ! grep -q "pinecone-client" ./requirements.txt; then
79
68
echo "pinecone-client not found in requirements.txt" >&2
@@ -83,24 +72,39 @@ runs:
83
72
- name : Set up Python
84
73
uses : actions/setup-python@v4
85
74
with :
86
- python-version : ${{ inputs.python-version }} }}}
75
+ python-version : ${{ inputs.python-version }}
87
76
88
- - name : Install dependencies
77
+ - name : locate site-packages path
78
+ shell : bash
79
+ run : |
80
+ echo "SITE_PACKAGES_PATH=$(python -c 'import site; print(site.getsitepackages()[0])')" >> $GITHUB_ENV
81
+
82
+ - name : Install pip
89
83
shell : bash
90
84
run : |
91
85
python -m pip install --upgrade pip
86
+
87
+ - name : Install dependencies
88
+ shell : bash
89
+ run : |
90
+ cp -R ./api/terraform/python/layer_genai/openai_utils ${{ env.SITE_PACKAGES_PATH }}
92
91
pip install -r ./requirements.txt
93
- pip install -r ${{ env.REQUIREMENTS_PATH }}
94
- cp -R ./api/terraform/python/layer_genai/openai_utils venv/lib/python ${{ inputs.python-version }}/site-packages/
92
+ env :
93
+ SITE_PACKAGES_PATH : ${{ env.SITE_PACKAGES_PATH }}
95
94
96
95
- name : Create .env
97
96
shell : bash
98
97
run : |
99
98
touch ./.env
100
- echo "OPENAI_API_ORGANIZATION=${{ secrets.OPENAI_API_ORGANIZATION }}" >> ./.env
101
- echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> ./.env
102
- echo "PINECONE_API_KEY=${{ secrets.PINECONE_API_KEY }}" >> ./.env
103
- echo "PINECONE_ENVIRONMENT=${{ secrets.PINECONE_ENVIRONMENT }}" >> ./.env
99
+ echo "OPENAI_API_ORGANIZATION=${{ env.OPENAI_API_ORGANIZATION }}" >> ./.env
100
+ echo "OPENAI_API_KEY=${{ env.OPENAI_API_KEY }}" >> ./.env
101
+ echo "PINECONE_API_KEY=${{ env.PINECONE_API_KEY }}" >> ./.env
102
+ echo "PINECONE_ENVIRONMENT=${{ env.PINECONE_ENVIRONMENT }}" >> ./.env
103
+ env :
104
+ OPENAI_API_ORGANIZATION : ${{ inputs.openai-api-organization }}
105
+ OPENAI_API_KEY : ${{ inputs.openai-api-key }}
106
+ PINECONE_API_KEY : ${{ inputs.pinecone-api-key }}
107
+ PINECONE_ENVIRONMENT : ${{ inputs.pinecone-environment }}
104
108
105
109
- name : Test lambda_openai_v2
106
110
shell : bash
0 commit comments