Skip to content

fix: address OpenAI compliance audit findings (streamed usage, request-id, docs) - #19

Closed
Abhinavexist wants to merge 1 commit into
mainfrom
fix/openai-compliance-audit
Closed

fix: address OpenAI compliance audit findings (streamed usage, request-id, docs)#19
Abhinavexist wants to merge 1 commit into
mainfrom
fix/openai-compliance-audit

Conversation

@Abhinavexist

Copy link
Copy Markdown
Collaborator

Addresses the findings from the OpenAI compliance audit (run against main v0.1.0). These are orthogonal to the other open PRs (#7#18) — none of them touched these paths.

Code fixes

  • inputs.audio() mishandles data: URIs (mislabels/garbage format) #2 — streamed usage dropped (the real bug)._State.accumulate read id/model/created/delta/finish/tool_calls but never chunk.usage; worse, the usage chunk arrives with empty choices, so accumulate returned before reaching any usage read. Now it captures chunk.usage (and system_fingerprint) before the choices check and surfaces them on get_final_completion(). Verified: stream_options={"include_usage": True}final.usage.total_tokens == 226.
  • file()/video() drop computed MIME → server sees application/octet-stream #3_request_id lost.to_interfaze round-trips through model_dump()/model_validate(), which drops the openai-attached _request_id. Now carried onto the result. (Latent today — the API doesn't send x-request-id yet — but no longer silently discarded.)
  • Appendix — pyprojectRepository pointed at the non-existent interfaze/interfaze-py; fixed to InterfazeAI/interfaze-python.

Docs (README "Compatibility notes")

Notes

- Streamed usage was dropped: _State never read chunk.usage (the usage
chunk has empty choices, so accumulate returned before reading it).
Capture chunk.usage + system_fingerprint and surface them on
get_final_completion(). (audit #2 - the real bug)
- Carry the server's _request_id through to_interfaze so it survives the
model_dump/model_validate round-trip. (audit #3)
- Fix pyproject Repository URL (interfaze/interfaze-py ->
InterfazeAI/interfaze-python). (audit appendix)
- README 'Compatibility notes': .stream() yields chunks not events;
content post-processing (json fence / <think>/<precontext> tags); inputs.*
URL non-portability; the interfaze.openai escape hatch; tasks.* return raw
results. (audit #1/#4/#5/#6 + task-return note)
Regression tests in tests/test_compliance.py (usage sync+async, request_id).
@Abhinavexist

Copy link
Copy Markdown
CollaboratorAuthor

Closing — the Issue #1 (.stream()) handling here was documentation-only, which doesn't resolve the OpenAI event-contract collision (a migrator's for event in stream code still breaks). Superseded by a new PR that properly aligns .stream() to OpenAI's event API, and re-carries the same #2 (streamed usage), #3 (request-id), pyproject-URL, and doc fixes.

@Khurdhula-HarshavardhanKhurdhula-Harshavardhan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please help resolve the following.

self.model = chunk.model
if not self.created and chunk.created:
self.created = chunk.created
if chunk.usage:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase on main; this reverts #7 and re-breaks precontext.

@Abhinavexist
Abhinavexist deleted the fix/openai-compliance-audit branch July 25, 2026 09:20
Sign up for freeto 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.

2 participants

@Abhinavexist@Khurdhula-Harshavardhan