Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement - update chat llm template #974

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading