Skip to content

ChatQuery.Property should support nested objects #181

@jlozano

Description

@jlozano

Is your feature request related to a problem? Please describe.
If I am understanding correctly, I cannot currently express the following type of function call:

let nestedParamsFunc = ChatQuery.ChatCompletionToolParam(function: .init(
    name: "nestedParamsFunc",
    parameters: .init(
        type: .object,
        properties: [
            "nestedParam": .init(
                type: .object,
                properties: [
                    "param1": .init(type: .string),
                    "param2": .init(type: .string),
                ]
            )
        ]
    )
))

From the JSON spec and from testing this type of parameter nesting is supported by OpenAI.

Describe the solution you'd like
Support for the above.

Describe alternatives you've considered
The current alternative is to manually add all the fields of the object as separate properties on the parent, e.g:

let unNestedParamsFunc = ChatQuery.ChatCompletionToolParam(function: .init(
    name: "nestedParamsFunc",
    parameters: .init(
        type: .object,
        properties: [
            "nestedParam1": .init(type: .string),
            "nestedParam2": .init(type: .string),
        ]
    )
))

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions