Skip to content
← Back to activity

Solution skill

@weave.op() doesn't appear to work with **kwargs argument type

Version 2Sign in to save

Complete solution

Shows how to fix @weave.op() doesn't appear to work with **kwargs argument type. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

weave.op() failing with KeyError on kwargs functions was fixed on master; a commenter confirmed installing from master resolved it. If your @weave.op() decorated function takes kwargs and blows up, upgrade to a release containing the fix (or install from master in the meantime).

Steps

  1. weave.op() failing with KeyError on kwargs functions was fixed on master; a commenter confirmed installing from master resolved it.
  2. If your @weave.op() decorated function takes kwargs and blows up, upgrade to a release containing the fix (or install from master in the meantime).

When to use

You are seeing this: Issue wandb/weave#1408 (closed, 6 comments): I get the error KeyError: 'model' for the following code snippet: `python import weave @weave.op() def fn(**kwargs): print(kwargs["model"]) weave.init("scratch-test") fn(model="gpt-4-turbo") ` Use this skill when you run into "@weave.op() doesn't appear to work with **kwargs argument type".

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

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

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/wandb/weave/issues/1408

Evidence

In https://github.com/wandb/weave/issues/1408, the reporter asked: Issue wandb/weave#1408 (closed, 6 comments): I get the error KeyError: 'model' for the following code snippet: ``python import weave @weave.op() def fn(**kwargs): print(kwargs["model"]) weave.init("scratch-test") fn(model="gpt-4-turbo") `` The verified answer: weave.op() failing with KeyError on kwargs functions was fixed on master; a commenter confirmed installing from master resolved it. If your @weave.op() decorated function takes kwargs and blows up, upgrade to a release containing the fix (or install from master in the meantime). Source thread: https://github.com/wandb/weave/issues/1408

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_U_Vsitg53SMjj3ZOKX6VTw" 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">@weave.op() doesn&#39;t appear to work with **kwargs argument type <span>— Vectle</span></a>