Skip to content

LCORE-3314: Use typed AddItemsRequest for conversation item creates - #2361

Open
asimurka wants to merge 2 commits into
lightspeed-core:feature/upgrade-ogx-to-1.2.xfrom
asimurka:feature/exceptions-refactor
Open

LCORE-3314: Use typed AddItemsRequest for conversation item creates#2361
asimurka wants to merge 2 commits into
lightspeed-core:feature/upgrade-ogx-to-1.2.xfrom
asimurka:feature/exceptions-refactor

Conversation

@asimurka

@asimurka asimurka commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

Switch conversation item appends (turns, shield responses, compaction markers) to AddItemsRequest, parsing raw dicts through ConversationItem.from_dict so OGX oneOf wrappers are validated before conversations.items.create. Drop the old items= / Stainless Item cast path and cover the helpers plus append flows in unit tests.

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library [pyproject.toml + uv.lock]
  • Bump-up dependent library [requirements.*.txt for Konflux]
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

Identify any AI code assistants used in this PR (for transparency and review context)

  • Assisted-by: Cursor

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 31bf3286-e882-41ff-a0a8-b6bd17a485e8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

"type": "message",
"role": "user",
"content": [
{"type": "input_text", "text": f"{MARKER_SENTINEL} {summary_text}"}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This can be simplified to plaintext message

None otherwise.
"""
try:
return ConversationItem.from_dict(data)

@asimurka asimurka Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

New client types use automatic anyOf validators that create the actual model instances from plain dicts. This is preferable to importing internal client models with obscurely long names.

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