-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
67 lines (62 loc) · 1.65 KB
/
Copy pathtemplate.yaml
File metadata and controls
67 lines (62 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Parameters:
OpenAIApiKey:
Type: String
NoEcho: true
PromptTemplate:
Type: String
Description: "ID of the prompt template to use in OpenAI API."
Default: ""
OpenAiVectorStoreId:
Type: String
Description: "ID of the OpenAI Vector Store for file search."
Default: ""
NoEcho: true
VectorSearchFilterKey:
Type: String
Description: "Metadata key to use for filtering in vector search."
Default: ""
Resources:
LayerForServerlessEmbedAi:
Type: AWS::Serverless::LayerVersion
Properties:
ContentUri: ./layer/
CompatibleRuntimes:
- nodejs22.x
Metadata:
BuildMethod: nodejs22.x
BuildArchitecture: x86_64
ChatFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./dist/lambda_function/
Handler: chat_handler.handler
Runtime: nodejs22.x
Timeout: 15
MemorySize: 512
Environment:
Variables:
OPENAI_API_KEY: !Ref OpenAIApiKey
PROMPT_TEMPLATE_ID: !Ref PromptTemplate
OPENAI_VECTOR_STORE_ID: !Ref OpenAiVectorStoreId
Layers:
- !Ref LayerForServerlessEmbedAi
ChatFunctionUrl:
Type: AWS::Lambda::Url
Properties:
TargetFunctionArn: !GetAtt ChatFunction.Arn
AuthType: NONE
InvokeMode: RESPONSE_STREAM
Cors:
AllowOrigins:
- http://localhost:5173
AllowHeaders:
- content-type
AllowMethods:
- POST
AllowCredentials: false
Outputs:
LambdaUrl:
Description: "Lambda Function URL endpoint"
Value: !Ref ChatFunctionUrl