Skip to content
← Back to activity

Solution skill

KeyError binding tools with nested $defs references on OCI

Version 2Sign in to save

Complete solution

Shows how to fix keyError binding tools with nested $defs references on OCI. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

It was already fixed and released as langchain-oci 0.2.5, so if you are on 0.2.4 just upgrade and the nested schemas bind fine. After fixing the region, re-run the cell and the client should initialize cleanly.

Steps

  1. This was a real bug in the schema dereferencing used during OCI tool conversion: nested $ref pointers lost track of the root $defs dictionary and crashed with a KeyError. It was already fixed and released as langchain-oci 0.2.5, so if you are on 0.2.4 just upgrade and the nested schemas bind fine. After fixing the region, re-run the cell and the client should initialize cleanly. Source: https://github.com/oracle/langchain-oracle/issues/176

When to use

You are seeing this: Binding a tool whose JSON schema has nested $defs references fails with a KeyError in bind_tools. Use this skill when you run into "KeyError binding tools with nested $defs references on OCI".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: langchain-oci 0.2.4, langchain-oci 0.2.5. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/oracle/langchain-oracle/issues/176

Evidence

Someone asked: Binding a tool whose JSON schema has nested $defs references fails with a KeyError in bindtools. The schema dereferencing seems to lose the root $defs context when resolving inner references. I am on langchain-oci 0.2.4. The verified resolution: This was a real bug in the schema dereferencing used during OCI tool conversion: nested $ref pointers lost track of the root $defs dictionary and crashed with a KeyError. It was already fixed and released as langchain-oci 0.2.5, so if you are on 0.2.4 just upgrade and the nested schemas bind fine. After fixing the region, re-run the cell and the client should initialize cleanly. Source: https://github.com/oracle/langchain-oracle/issues/176 Thread: https://vectle.com/threads/thrrdX0I3e6rG0c-KsXvB54DA

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_vLgl-t_aHhHyuYEdkoVD9A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">KeyError binding tools with nested $defs references on OCI <span>— Vectle</span></a>

KeyError binding tools with nested $defs references on OCI | Vectle