Skip to content

Commit d7fb297

Browse files
authored
Merge pull request #225 from FullStackWithLawrence/next
refactor request templates for openai api v1 object_type
2 parents 2c2798e + c857082 commit d7fb297

File tree

8 files changed

+53
-44
lines changed

8 files changed

+53
-44
lines changed

CHANGELOG.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@
88

99
# [0.8.0](https://github.com/FullStackWithLawrence/aws-openai/compare/v0.7.2...v0.8.0) (2023-12-30)
1010

11-
1211
### Bug Fixes
1312

14-
* add an error boundary ([4b7d021](https://github.com/FullStackWithLawrence/aws-openai/commit/4b7d02113d4c06f57aef067155f458ca3857d60c))
15-
* convert return value to json if necessary. also verify dict keys before attempting to access anything ([376e14d](https://github.com/FullStackWithLawrence/aws-openai/commit/376e14defa77cef7d1bbc55ce98176f7b7be41bc))
16-
* ensure that error messages are strings ([7c01083](https://github.com/FullStackWithLawrence/aws-openai/commit/7c01083e780391e637f551f4f49a76670ff771a7))
17-
* scaffold an Error Boundary for the chatapp ([3fcbdb6](https://github.com/FullStackWithLawrence/aws-openai/commit/3fcbdb6c55d6748a1789d51e051cc8fab9b9456a))
18-
13+
- add an error boundary ([4b7d021](https://github.com/FullStackWithLawrence/aws-openai/commit/4b7d02113d4c06f57aef067155f458ca3857d60c))
14+
- convert return value to json if necessary. also verify dict keys before attempting to access anything ([376e14d](https://github.com/FullStackWithLawrence/aws-openai/commit/376e14defa77cef7d1bbc55ce98176f7b7be41bc))
15+
- ensure that error messages are strings ([7c01083](https://github.com/FullStackWithLawrence/aws-openai/commit/7c01083e780391e637f551f4f49a76670ff771a7))
16+
- scaffold an Error Boundary for the chatapp ([3fcbdb6](https://github.com/FullStackWithLawrence/aws-openai/commit/3fcbdb6c55d6748a1789d51e051cc8fab9b9456a))
1917

2018
### Features
2119

22-
* add v2 Settings class ([da8943d](https://github.com/FullStackWithLawrence/aws-openai/commit/da8943d55a568f1196e9389d8f3aaee1b15408bb))
23-
* add v2 Settings class ([240433b](https://github.com/FullStackWithLawrence/aws-openai/commit/240433bd2a50c32da4bdf484420bc86b9db545d6))
20+
- add v2 Settings class ([da8943d](https://github.com/FullStackWithLawrence/aws-openai/commit/da8943d55a568f1196e9389d8f3aaee1b15408bb))
21+
- add v2 Settings class ([240433b](https://github.com/FullStackWithLawrence/aws-openai/commit/240433bd2a50c32da4bdf484420bc86b9db545d6))
2422

2523
## [0.7.2](https://github.com/FullStackWithLawrence/aws-openai/compare/v0.7.1...v0.7.2) (2023-12-19)
2624

api/terraform/apigateway_endpoints.tf

Lines changed: 30 additions & 30 deletions
Large diffs are not rendered by default.

api/terraform/endpoint/api_gateway_endpoint.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ locals {
88
openai_integration_template = templatefile(
99
"${path.module}/mapping-templates/openai-integration.tpl",
1010
{
11+
mapping_object_type = var.mapping_object_type
1112
mapping_model = var.mapping_model
1213
mapping_role_system_content = var.mapping_role_system_content
1314
mapping_end_point = var.mapping_end_point

api/terraform/endpoint/mapping-templates/openai-integration.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
22
{
3-
"object_type": "chat.completion",
3+
"object_type": "${mapping_object_type}",
44
"model": "${mapping_model}",
55
"end_point": "${mapping_end_point}",
66
"temperature": ${mapping_temperature},

api/terraform/endpoint/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ variable "aws_iam_role_arn" {
3838
###############################################################################
3939
# OpenAI mapping template
4040
###############################################################################
41+
variable "mapping_object_type" {
42+
description = "OpenAI Python API class to invoke."
43+
type = string
44+
default = "chat.completion"
45+
46+
}
4147
variable "mapping_model" {
4248
# see https://platform.openai.com/docs/models/overview
4349
description = "which OpenAI model to use"

api/terraform/python/layer_genai/requirements.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
# named `venv`. Terraform modules will look for and include these
88
# requirements in the zip package for this layer.
99
# -----------------------------------------------------------------------------
10-
python-dotenv==1.0.0
11-
openai==1.6.1
10+
11+
# generative AI requirements
1212
langchain
1313
langchain-experimental
14+
openai==1.6.1
1415
pinecone-client==2.2.4
16+
17+
# general requirements
1518
pydantic==2.5.3
1619
pydantic-settings==2.1.0
1720
python-dotenv==1.0.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22
# DO NOT EDIT.
33
# Managed via automated CI/CD in .github/workflows/semanticVersionBump.yml.
4-
__version__ = "0.8.0"
4+
__version__ = "0.8.1"

api/terraform/python/openai_api/common/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,14 @@ def aws_secret_access_key_source(self):
384384
@property
385385
def aws_auth(self) -> dict:
386386
"""AWS authentication"""
387-
return {
387+
retval = {
388388
"aws_profile": self.aws_profile,
389389
"aws_access_key_id_source": self.aws_access_key_id_source,
390390
"aws_secret_access_key_source": self.aws_secret_access_key_source,
391391
"aws_region": self.aws_region,
392-
"init_info": self.init_info,
393392
}
393+
if self.init_info:
394+
retval["init_info"] = self.init_info
394395

395396
@property
396397
def aws_session(self):

0 commit comments

Comments
 (0)