Skip to content

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Nov 15, 2025

Disclaimer: Experimental PR review

Greptile Overview

Greptile Summary

This PR updates the API specification to add crucial documentation about URL encoding requirements for prompt names that contain folder paths.

Changes:

  • Enhanced parameter documentation for name and prompt_name parameters across sync and async client methods
  • Clarified that folder paths in prompt names (e.g., "folder/subfolder/prompt-name") must be URL encoded with forward slashes converted to %2F
  • Added concrete examples showing correct encoding format ("folder%2Fsubfolder%2Fprompt-name")
  • Updated both API reference markdown and Python client docstrings consistently

Analysis:
The documentation changes are correct and necessary. The underlying implementation uses jsonable_encoder() which returns strings as-is without URL encoding, meaning users are responsible for pre-encoding prompt names containing slashes. This documentation update properly clarifies this requirement to prevent API call failures.

Confidence Score: 5/5

  • This PR is safe to merge - it only adds clarifying documentation with no functional changes
  • This is a documentation-only change that clarifies an existing API requirement. No code logic was modified, only docstrings and markdown documentation. The changes are consistent across all affected files and accurately describe the URL encoding behavior required by the existing implementation.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
langfuse/api/reference.md 5/5 Documentation updated to clarify URL encoding requirement for prompt names with folder paths
langfuse/api/resources/prompt_version/client.py 5/5 Added docstring clarification for URL encoding of prompt names in folder paths
langfuse/api/resources/prompts/client.py 5/5 Added docstring clarification for URL encoding of prompt names in folder paths

Sequence Diagram

sequenceDiagram
    participant User
    participant PromptsClient
    participant PromptVersionClient
    participant HTTPClient
    participant API as Langfuse API

    Note over User,API: Get Prompt Flow
    User->>PromptsClient: get(prompt_name="folder%2Fprompt")
    PromptsClient->>PromptsClient: jsonable_encoder(prompt_name)
    PromptsClient->>HTTPClient: request(f"api/public/v2/prompts/{prompt_name}")
    HTTPClient->>API: GET /api/public/v2/prompts/folder%2Fprompt
    API-->>HTTPClient: Prompt response
    HTTPClient-->>PromptsClient: Parse response
    PromptsClient-->>User: Return Prompt object

    Note over User,API: Update Prompt Version Flow
    User->>PromptVersionClient: update(name="folder%2Fprompt", version=1)
    PromptVersionClient->>PromptVersionClient: jsonable_encoder(name)
    PromptVersionClient->>HTTPClient: request(f"api/public/v2/prompts/{name}/versions/{version}")
    HTTPClient->>API: PATCH /api/public/v2/prompts/folder%2Fprompt/versions/1
    API-->>HTTPClient: Updated Prompt response
    HTTPClient-->>PromptVersionClient: Parse response
    PromptVersionClient-->>User: Return Prompt object
Loading

Important

Update API spec and client code to handle URL encoding for prompt names with folder paths.

  • Behavior:
    • Updated API documentation in reference.md to specify that prompt names with folder paths must be URL encoded.
    • Updated update() in PromptVersionClient and AsyncPromptVersionClient to handle URL encoding for prompt names.
    • Updated get() in PromptsClient and AsyncPromptsClient to handle URL encoding for prompt names.
  • Documentation:
    • Added detailed instructions in reference.md for URL encoding folder paths in prompt names.
  • Code:
    • Modified update() in prompt_version/client.py to include URL encoding logic.
    • Modified get() in prompts/client.py to include URL encoding logic.

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

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.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

2 participants