Skip to content

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Jan 9, 2026

Important

Make retention parameter optional in update() method of ProjectsClient and AsyncProjectsClient, retaining existing setting if omitted.

  • Behavior:
    • Make retention parameter optional in update() method of ProjectsClient and AsyncProjectsClient.
    • If retention is omitted, existing retention setting is retained.
  • Documentation:
    • Update langfuse/api/reference.md to reflect optional retention parameter in client.projects.update() examples.
  • Code:
    • Modify update() method in client.py to set retention as typing.Optional[int] in both ProjectsClient and AsyncProjectsClient.

This description was created by Ellipsis for 4006fc5. You can customize this summary. It will automatically update as commits are pushed.

Disclaimer: Experimental PR review

Greptile Overview

Greptile Overview

Greptile Summary

This PR updates the auto-generated API client to make the retention parameter optional in the ProjectsClient.update() and AsyncProjectsClient.update() methods.

Key Changes

API Signature Update:

  • Changed retention: int to retention: typing.Optional[int] = OMIT in both sync and async update methods
  • Reordered parameters from (name, retention, metadata) to (name, metadata, retention) to follow Python conventions (required before optional)
  • When retention is omitted, the existing project retention setting is preserved on the backend

Implementation Details:

  • Uses the existing OMIT sentinel pattern (Ellipsis) consistently used throughout the codebase
  • The remove_omit_from_dict() function in the HTTP client filters out OMIT values before sending requests
  • When retention=OMIT, the parameter is excluded from the HTTP request body entirely, allowing the backend to preserve the existing value

Documentation Updates:

  • Removed retention=1 from the usage example to demonstrate the new optional behavior
  • Updated parameter documentation to clarify that retention is optional and will preserve existing settings if omitted
  • Improved formatting of retention parameter description with multi-line explanation

Backward Compatibility

This change is fully backward compatible:

  • All parameters after project_id use keyword-only syntax (after *), so parameter reordering does not break existing code
  • Existing code that passes retention will continue to work unchanged
  • New code can omit retention to preserve existing project settings

Consistency

Both ProjectsClient and AsyncProjectsClient received identical updates, maintaining API consistency across sync and async interfaces.

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • Score reflects thorough implementation with no issues found. The changes are auto-generated from the API spec, follow existing OMIT patterns consistently, maintain backward compatibility, update both sync and async clients identically, and include proper documentation updates. The OMIT mechanism correctly filters optional parameters from the request body, allowing the backend to preserve existing retention settings when omitted.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
langfuse/api/resources/projects/client.py 5/5 Made retention parameter optional in update() methods for both ProjectsClient and AsyncProjectsClient, enabling existing retention settings to be preserved when omitted
langfuse/api/reference.md 5/5 Updated documentation to reflect optional retention parameter in client.projects.update() examples and parameter descriptions

Sequence Diagram

sequenceDiagram
    participant Client as User Code
    participant PC as ProjectsClient
    participant HC as HttpClient
    participant API as Langfuse API
    
    Note over Client,API: Update with retention (existing behavior)
    Client->>PC: update(project_id, name, retention=30)
    PC->>PC: Build JSON body with retention
    PC->>HC: request(json={name, metadata, retention})
    HC->>HC: remove_omit_from_dict()
    HC->>API: PUT /api/public/projects/{id}
    API-->>HC: 200 OK with Project
    HC-->>PC: Project response
    PC-->>Client: Project object
    
    Note over Client,API: Update without retention (new behavior)
    Client->>PC: update(project_id, name)
    Note over PC: retention defaults to OMIT
    PC->>PC: Build JSON body with retention=OMIT
    PC->>HC: request(json={name, metadata, retention=OMIT})
    HC->>HC: remove_omit_from_dict() filters out OMIT
    HC->>API: PUT /api/public/projects/{id}<br/>(retention not in payload)
    Note over API: Retains existing<br/>retention value
    API-->>HC: 200 OK with Project
    HC-->>PC: Project response
    PC-->>Client: Project object
Loading

Important Files Changed

File Analysis

Filename Score Overview
langfuse/api/resources/projects/client.py 5/5 Made retention parameter optional in update() methods for both ProjectsClient and AsyncProjectsClient, enabling existing retention settings to be preserved when omitted
langfuse/api/reference.md 5/5 Updated documentation to reflect optional retention parameter in client.projects.update() examples and parameter descriptions

Sequence Diagram

sequenceDiagram
    participant Client as User Code
    participant PC as ProjectsClient
    participant HC as HttpClient
    participant API as Langfuse API
    
    Note over Client,API: Update with retention (existing behavior)
    Client->>PC: update(project_id, name, retention=30)
    PC->>PC: Build JSON body with retention
    PC->>HC: request(json={name, metadata, retention})
    HC->>HC: remove_omit_from_dict()
    HC->>API: PUT /api/public/projects/{id}
    API-->>HC: 200 OK with Project
    HC-->>PC: Project response
    PC-->>Client: Project object
    
    Note over Client,API: Update without retention (new behavior)
    Client->>PC: update(project_id, name)
    Note over PC: retention defaults to OMIT
    PC->>PC: Build JSON body with retention=OMIT
    PC->>HC: request(json={name, metadata, retention=OMIT})
    HC->>HC: remove_omit_from_dict() filters out OMIT
    HC->>API: PUT /api/public/projects/{id}<br/>(retention not in payload)
    Note over API: Retains existing<br/>retention value
    API-->>HC: 200 OK with Project
    HC-->>PC: Project response
    PC-->>Client: Project object
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@hassiebp hassiebp merged commit 25c5ef9 into main Jan 10, 2026
12 checks passed
@hassiebp hassiebp deleted the api-spec-bot-99ffc45 branch January 10, 2026 09:30
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.

3 participants