From b98d013191d504961364e4044db66914ed3b5f0b Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 30 Nov 2023 16:57:21 +0100 Subject: [PATCH 1/2] Update - changed parameter from messages to inputs --- examples/startup_technical_ideas/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/startup_technical_ideas/app.py b/examples/startup_technical_ideas/app.py index 8838e51852..6b4241003c 100644 --- a/examples/startup_technical_ideas/app.py +++ b/examples/startup_technical_ideas/app.py @@ -23,8 +23,8 @@ @ag.entrypoint -def chat(messages: MessagesInput = MessagesInput()) -> str: - messages = [{"role": "system", "content": ag.config.prompt_system}] + messages +def chat(inputs: MessagesInput = MessagesInput()) -> str: + messages = [{"role": "system", "content": ag.config.prompt_system}] + inputs max_tokens = ag.config.max_tokens if ag.config.max_tokens != -1 else None chat_completion = client.chat.completions.create( model=ag.config.model, From a100fefa94f6ebde888c51fbfdf3914060cd6f98 Mon Sep 17 00:00:00 2001 From: Abram Date: Thu, 30 Nov 2023 17:15:19 +0100 Subject: [PATCH 2/2] Update - revert detection back to inputs --- agenta-web/src/lib/helpers/openapi_parser.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/agenta-web/src/lib/helpers/openapi_parser.ts b/agenta-web/src/lib/helpers/openapi_parser.ts index 5e87360d54..57e39bb26d 100644 --- a/agenta-web/src/lib/helpers/openapi_parser.ts +++ b/agenta-web/src/lib/helpers/openapi_parser.ts @@ -21,11 +21,9 @@ const getBodySchemaName = (schema: GenericObject): string => { export const detectChatVariantFromOpenAISchema = (schema: GenericObject) => { const bodySchemaName = getBodySchemaName(schema) - const bodyProperties = schema.components.schemas[bodySchemaName].properties - const propertiesWithMessages = Object.keys(bodyProperties).filter((property) => { - return bodyProperties[property]["x-parameter"] === "messages" - }) - return propertiesWithMessages[0] === "messages" + return ( + schema.components.schemas[bodySchemaName].properties?.inputs?.["x-parameter"] === "messages" + ) } export const openAISchemaToParameters = (schema: GenericObject): Parameter[] => {