Skip to content

chat(protocol="chat_completions") and the compat note on chat_completions() - #493

Open
rejojer wants to merge 3 commits into
mainfrom
feat/chat-protocol-chat-completions
Open

chat(protocol="chat_completions") and the compat note on chat_completions()#493
rejojer wants to merge 3 commits into
mainfrom
feat/chat-protocol-chat-completions

Conversation

@rejojer

@rejojer rejojer commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

  • chat() gains a third protocol value, "chat_completions": the answer lane's own engine with its Chat Completions envelope kept (chunk dicts when streaming, instructions as a leading system row). It is the one protocol the managed cloud chat serves, so that lane opens without a chat model; the own-model knobs still refuse there.
  • chat_completions() stays public with its signature unchanged. Its docstring now marks it as kept for existing code and points new code at chat(), so everything it offers has a route that does not go through the old name. No warning, no __getattr__ interception.
  • The managed endpoint takes extra_body as its own request fields (temperature, enable_citations), merged into the payload last under the same skeleton refusal as the other lanes.
  • Strings that steered callers to chat_completions() now name the protocol lane; the cookbook's two cells use chat(). Descriptive mentions are untouched.

Verification

  • 494 passed; the three new tests fail against main's code.
  • Without-frameworks leg passes (agents blocked in sys.modules).
  • pyright 236, same as main.

https://claude.ai/code/session_015b7YGZ8LvYp2Q3oGNN8Lfc

…ions()

chat() gains the third protocol value: the answer lane's own engine
with its Chat Completions envelope kept (chunk dicts when streaming,
instructions as a leading system row). It is the one protocol the
managed cloud chat serves, so that lane opens without a chat model;
the own-model knobs still refuse there.

chat_completions() stays, unchanged in signature, with a docstring
that marks it as kept for existing code and points new code at
chat(). Error strings that steered callers to it now name the protocol
lane; the cookbook's two cells use chat().

The managed endpoint takes extra_body as its own request fields
(temperature, enable_citations), merged last under the skeleton
refusal, so new code reaches them without the old door.

Claude-Session: https://claude.ai/code/session_015b7YGZ8LvYp2Q3oGNN8Lfc
The protocol overloads name "chat_completions" so the literal narrows
to the envelope dict and the chunk-dict iterator; the protocol arg doc
lists it and notes the managed chat serves it; the show_process texts
no longer promise a transcript the Chat Completions lane has none of.

Claude-Session: https://claude.ai/code/session_015b7YGZ8LvYp2Q3oGNN8Lfc
…weep

- _split_chat_messages rejected tool rows and structured content with
  "use chat(protocol=...)", which is the lane the caller just used now
  that chat_completions is a protocol value; name responses / messages.
- submit_query / get_retrieval still steered to chat_completions(), the
  door this branch demotes to compat; steer to chat() like the rest.
- Three docstring claims narrowed to where they hold: the compat note's
  "everything is chat(protocol=...)" excepts the text-only stream (that
  is chat(stream=True, show_process=False)); system rows join the
  managed prompt only with your own chat model, the managed endpoint
  forwards them verbatim; extra_body is verbatim on Responses, Messages
  and the managed endpoint, while own-model chat_completions splits it
  like the answer lane.
- Tests: drop the warnings guard around a deprecation that does not
  exist and the comments restating assertions; the managed-lane
  skeleton test now calls the lane it is named for.

Claude-Session: https://claude.ai/code/session_014bdfnYbWsejWhuphPt1aSv
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

Successfully merging this pull request may close these issues.

1 participant