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

ChatQuery.Property should support nested objects #181

Open
jlozano opened this issue Mar 13, 2024 · 0 comments
Open

ChatQuery.Property should support nested objects #181

jlozano opened this issue Mar 13, 2024 · 0 comments

Comments

@jlozano
Copy link

jlozano commented Mar 13, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant