Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: crmne/ruby_llm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.13.0
Choose a base ref
...
head repository: crmne/ruby_llm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.13.1
Choose a head ref
  • 5 commits
  • 10 files changed
  • 3 contributors

Commits on Mar 4, 2026

  1. Updated contributing guide

    crmne committed Mar 4, 2026
    Configuration menu
    Copy the full SHA
    526c9a0 View commit details
    Browse the repository at this point in the history
  2. Fix binary attachment reads on Windows

    Use File.binread for path attachments to avoid text-mode truncation on Windows and add a regression spec ensuring path attachments are read in binary mode.
    crmne committed Mar 4, 2026
    Configuration menu
    Copy the full SHA
    b8df073 View commit details
    Browse the repository at this point in the history
  3. Fix schema JSON parsing for intermediate tool-call responses (#650)

    ## Summary
    
    Fixes #649
    
    When both `with_schema` and `with_tool` are used together, the
    `complete` method unconditionally parses any string `response.content`
    as JSON whenever a schema is set — including intermediate responses that
    also contain tool calls.
    
    On the next API call, the parsed Hash gets serialized as `{ type:
    "text", text: <Hash> }`, which providers like Anthropic reject with:
    
    ```
    text.text: Input should be a valid string
    ```
    
    ### Root cause
    
    In `lib/ruby_llm/chat.rb`, the JSON parsing condition:
    
    ```ruby
    if @Schema && response.content.is_a?(String)
    ```
    
    does not check whether the response is an intermediate tool-call
    response, so it eagerly parses content that should remain as a plain
    string.
    
    ### Fix
    
    Add a `!response.tool_call?` guard so JSON parsing is only applied to
    the final (non-tool-call) response:
    
    ```ruby
    if @Schema && response.content.is_a?(String) && !response.tool_call?
    ```
    
    ### Test
    
    Added a regression test that mocks the provider to return an
    intermediate tool-call response with JSON-like text content, verifying
    that:
    - The intermediate tool-call message keeps its content as a `String`
    - The final non-tool-call response has its content parsed into a `Hash`
    
    ---------
    
    Co-authored-by: Claude Opus 4.6 <[email protected]>
    Co-authored-by: Carmine Paolino <[email protected]>
    3 people authored Mar 4, 2026
    Configuration menu
    Copy the full SHA
    beec837 View commit details
    Browse the repository at this point in the history
  4. Populate Gemini cached token usage

    Map usageMetadata.cachedContentTokenCount to cached_tokens for Gemini chat responses and streaming chunks, and add provider specs covering both paths.
    crmne committed Mar 4, 2026
    Configuration menu
    Copy the full SHA
    1094945 View commit details
    Browse the repository at this point in the history
  5. Bump to 1.13.1

    crmne committed Mar 4, 2026
    Configuration menu
    Copy the full SHA
    97c0546 View commit details
    Browse the repository at this point in the history
Loading