Skip to content

Support top level List[T] type for iterable's, partial's and raw responses #1146

@aretrace

Description

@aretrace

It would be really useful to be able to return an object type of list when using client.chat.completions.create_iterable / create_partial / create_with_completion. The patched client currently only supports list with vanilla create:

class T(BaseModel):
        ...

response = client.chat.completions.create(
        model="gpt-3.5-turbo",
        messages=[
            {"role": "system", "content": "..."},
            {"role": "user", "content": "..."},
        ],
        response_model=List[T],
    )

create_with_completion would be a priority for this support (create already works).

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