Skip to content

Commit

Permalink
Merge pull request #974 from Agenta-AI/gh/update-chat-llm-template
Browse files Browse the repository at this point in the history
Enhancement - update chat llm template
  • Loading branch information
mmabrouk authored Nov 30, 2023
2 parents eb541a2 + a100fef commit 703c774
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions agenta-web/src/lib/helpers/openapi_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] => {
Expand Down
4 changes: 2 additions & 2 deletions examples/startup_technical_ideas/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 703c774

Please sign in to comment.