Skip to content

BFCL/openai: harden msgspec adapter tests + hoist imports + gc docstring for tool_choice #396

Description

@Palanivelg

Follow-up to PR #346 (thread #346 (comment)).

In tests/unit/openai/test_msgspec_adapter.py and openai/types.py (@viraatc):

  1. Hoist the in-function imports (ModelParams etc.) to module top per AGENTS.md no-lazy-imports rule.
  2. Cover the untested wire-format changes with small encode-and-assert tests: stream is now omitted when streaming is off (previously "stream": false), tool_choice encoding has no test, and nothing pins that seed=None is omitted from the encoded payload per omit_defaults.
  3. In openai/types.py, add tool_choice to the gc=False AT-RISK mutable-field list in the ChatCompletionRequest docstring (it can hold a dict).

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