Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
monst committed Oct 12, 2023
1 parent 394de2e commit f6a9fb3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/routes/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def execute_call(body: SendMessageRequest) -> dict:
def send_message(body: SendMessageRequest) -> SendMessageResponse:
generated_vars = execute_call(body)

# Restore the old behavior of only returning the 'response' variable for the v1 API
# Restore the old behavior of throwing an exception if no 'response' variable was generated
if "response" not in generated_vars:
raise InternalServerException(
str(ValueError("The handlebars do not generate 'response'"))
Expand All @@ -75,7 +75,7 @@ def send_message(body: SendMessageRequest) -> SendMessageResponse:
content=[
Content(
type=ContentType.TEXT,
textContent=generated_vars["response"],
textContent=generated_vars["response"], # V1 behavior: only return the 'response' variable
)
],
),
Expand All @@ -91,5 +91,5 @@ def send_message_v2(body: SendMessageRequest) -> SendMessageResponseV2:
return SendMessageResponseV2(
usedModel=body.preferred_model,
sentAt=datetime.now(timezone.utc),
content=generated_vars,
content=generated_vars, # V2 behavior: return all variables generated in the program
)

0 comments on commit f6a9fb3

Please sign in to comment.