wandb / weave

Weave is a toolkit for developing AI-powered applications, built by Weights & Biases.
https://wandb.me/weave
Apache License 2.0
659 stars 49 forks source link

Update scorer.py #2214

Closed maximepeabody closed 2 weeks ago

maximepeabody commented 2 weeks ago

This was giving me a bug.

circle-job-mirror[bot] commented 2 weeks ago

This PR requires manual approval from a wandb user to run all CI checks.

To see the current diff, click here.

To approve CI for this PR as of this commit, comment:

/approve d772083029e910b782f0c24568b04f1d7d2c27bb
github-actions[bot] commented 2 weeks ago

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

circle-job-mirror[bot] commented 2 weeks ago

Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=afab9fb1597c2bd121e328bc8dbcc52b5f4aa1c9

jamie-rasmussen commented 2 weeks ago

Hi Maxime, thanks for writing in. This change seems unnecessary to me because an empty list should already be falsy in Python. Can you provide more information about the error you were encountering?

maximepeabody commented 2 weeks ago

Hey Jamie, yeah I should have included more info, sorry about that!

I'm trying to run an eval here: https://wandb.ai/liftoff/monetize-outbound-agent/weave/evaluations?peekPath=%2Fliftoff%2Fmonetize-outbound-agent%2Fcalls%2Fc98f0b67-d411-4acf-aef9-e4282595db5a

which is giving this error trace:

Traceback (most recent call last):
File "/Users/mpeabody/genai-sales/agent/evals/eval.py", line 71, in <module>
cold_email_eval()
File "/Users/mpeabody/genai-sales/agent/evals/eval.py", line 66, in cold_email_eval
asyncio.run(evaluation.evaluate(eval_function))
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
self.run_forever()
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
self._run_once()
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
handle._run()
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/trace/op.py", line 328, in wrapper
res, _ = await _execute_call(wrapper, call, *args, **kwargs) # type: ignore
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/trace/op.py", line 209, in _call_async
res = await func(*args, **kwargs)
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/flow/eval.py", line 313, in evaluate
summary = await self.summarize(eval_rows)
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/trace/op.py", line 328, in wrapper
res, _ = await _execute_call(wrapper, call, *args, **kwargs) # type: ignore
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/trace/op.py", line 211, in _call_async
return handle_exception(e)
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/trace/op.py", line 209, in _call_async
res = await func(*args, **kwargs)
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/flow/eval.py", line 264, in summarize
model_output_summary = auto_summarize(vals)
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/flow/scorer.py", line 59, in auto_summarize
if (summary := auto_summarize([x[k] for x in data])) is not None:
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/flow/scorer.py", line 59, in auto_summarize
if (summary := auto_summarize([x[k] for x in data])) is not None:
File "/Users/mpeabody/.pyenv/versions/3.10.14/lib/python3.10/site-packages/weave/flow/scorer.py", line 47, in auto_summarize
val = data[0]
IndexError: list index out of range
maximepeabody commented 2 weeks ago

Oh you know what, I think I had an old version of weave running in my environment. Issue is fixed.

jamie-rasmussen commented 2 weeks ago

Glad to hear that - thanks for letting us know!