You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run the example code for streaming responses I get a pydantic type validation error.
The pydantic type for the Task has changed since this was written and the stream property was removed.
As the cf.run method passes all unrecognized keyword arguments to the Task constructor, and the Task type rejects additional properties, the code now causes an exception.
The error follows:
---------------------------------------------------------------------------
ValidationError Traceback (most recent call last)
Cell In[7], line 4
1 import controlflow as cf
3 # Stream all events
----> 4 for event, snapshot, delta in cf.run("Write a poem", stream=True, handlers=[]):
5 print(f"Event type: {event.event}")
7 if event.event == "agent-content":
File [~/.cache/pypoetry/virtualenvs/ask-anything-d4NqA-em-py3.12/lib/python3.12/site-packages/controlflow/run.py:127](http://127.0.0.1:8889/home/matthew/.cache/pypoetry/virtualenvs/ask-anything-d4NqA-em-py3.12/lib/python3.12/site-packages/controlflow/run.py#line=126), in run(objective, turn_strategy, max_llm_calls, max_agent_turns, raise_on_failure, handlers, model_kwargs, run_until, **task_kwargs)
115 def run(
116 objective: str,
117 *,
(...)
125 **task_kwargs,
126 ) -> Any:
--> 127 task = Task(objective=objective, **task_kwargs)
128 results = run_tasks(
129 tasks=[task],
130 raise_on_failure=raise_on_failure,
(...)
136 run_until=run_until,
137 )
138 return results[0]
File [~/.cache/pypoetry/virtualenvs/ask-anything-d4NqA-em-py3.12/lib/python3.12/site-packages/controlflow/tasks/task.py:224](http://127.0.0.1:8889/home/matthew/.cache/pypoetry/virtualenvs/ask-anything-d4NqA-em-py3.12/lib/python3.12/site-packages/controlflow/tasks/task.py#line=223), in Task.__init__(self, objective, user_access, **kwargs)
218 warnings.warn(
219 "The `user_access` argument is deprecated. Use `interactive=True` instead.",
220 DeprecationWarning,
221 )
222 kwargs["interactive"] = True
--> 224 super().__init__(**kwargs)
226 # create dependencies to tasks passed in as depends_on
227 for task in self.depends_on:
File [~/.cache/pypoetry/virtualenvs/ask-anything-d4NqA-em-py3.12/lib/python3.12/site-packages/pydantic/main.py:212](http://127.0.0.1:8889/home/matthew/.cache/pypoetry/virtualenvs/ask-anything-d4NqA-em-py3.12/lib/python3.12/site-packages/pydantic/main.py#line=211), in BaseModel.__init__(self, **data)
210 # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
211 __tracebackhide__ = True
--> 212 validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
213 if self is not validated_self:
214 warnings.warn(
215 'A custom validator is returning a value other than `self`.\n'
216 "Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
217 'See the `model_validator` docs (https://docs.pydantic.dev/latest/concepts/validators/#model-validators) for more details.',
218 category=None,
219 )
ValidationError: 1 validation error for Task
stream
Extra inputs are not permitted [type=extra_forbidden, input_value=True, input_type=bool]
For further information visit https://errors.pydantic.dev/2.9/v/extra_forbidden
Description
When I run the example code for streaming responses I get a pydantic type validation error.
The pydantic type for the
Task
has changed since this was written and thestream
property was removed.As the
cf.run
method passes all unrecognized keyword arguments to theTask
constructor, and theTask
type rejects additional properties, the code now causes an exception.The error follows:
Fundamentally this is because the 0.12.0 version of control flow has not been released to pypi!
https://pypi.org/project/controlflow/#history
Example Code
Version Information
Additional Context
No response
The text was updated successfully, but these errors were encountered: