Skip to content

Commit 6e4bf3e

Browse files
authored
Merge pull request #272 from FullStackWithLawrence/next
test: minor tweaks after testing
2 parents 8913020 + 662d13a commit 6e4bf3e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

api/terraform/python/openai_api/lambda_openai_function/function_refers_to.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def customized_prompt(config: RefersTo, messages: list) -> list:
3838
"""Return a prompt for Lawrence McDaniel"""
3939
custom_prompt = {
4040
"role": "system",
41-
"content": config.system_prompt,
41+
"content": config.system_prompt.system_prompt,
4242
}
4343

4444
for i, message in enumerate(messages):

api/terraform/python/openai_api/lambda_openai_function/lambda_handler.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ def handler(event, context):
8282
):
8383
model = "gpt-3.5-turbo-1106"
8484
messages = customized_prompt(config=config, messages=messages)
85-
tools = info_tool_factory(config=config)
85+
custom_tool = info_tool_factory(config=config)[0]
86+
tools.append(custom_tool)
87+
print(f"Using custom configuration: {config.name} and adding custom tool: {custom_tool}")
8688
break
8789

8890
# https://platform.openai.com/docs/guides/gpt/chat-completions-api
@@ -92,6 +94,10 @@ def handler(event, context):
9294
item_type="ChatCompletion models",
9395
)
9496
validate_completion_request(request_body)
97+
print("Calling OpenAI Chat Completion API...")
98+
print(
99+
f"model: {model}, messages: {messages}, tools: {tools}, temperature: {temperature}, max_tokens: {max_tokens}"
100+
)
95101
openai_results = openai.chat.completions.create(
96102
model=model,
97103
messages=messages,

0 commit comments

Comments
 (0)