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
If you have a separate parse_func where you add type annotation to the argument, you get this strange error.
e.g.
frombespokelabsimportcuratorfromdatasetsimportDatasetfrompydanticimportBaseModel, FieldfromtypingimportList# Create a dataset object for the topics you want to create the poems.topics=Dataset.from_dict({"topic": [
"Urban loneliness in a bustling city",
"Beauty of Bespoke Labs's Curator library"
]})
# Define a class to encapsulate a list of poems.classPoem(BaseModel):
poem: str=Field(description="A poem.")
classPoems(BaseModel):
poems_list: List[Poem] =Field(description="A list of poems.")
# removing the type annotation for `poems` works fine.defparse_func(row, poems: Poems):
return [
{"topic": row["topic"], "poem": p.poem} forpinpoems.poems_list
]
# We define a Prompter that generates poems which gets applied to the topics dataset.poet=curator.Prompter(
prompt_func=lambdarow: f"Write two poems about {row['topic']}.",
model_name="gpt-4o-mini",
response_format=Poems,
parse_func=parse_func,
)
poem=poet(topics)
print(poem.to_pandas())
Error:
TypeError Traceback (most recent call last)
[<ipython-input-4-38125e72f173>](https://localhost:8080/#) in <cell line: 35>()
33 parse_func=parse_func,
34 )
---> 35 poem = poet(topics)
36 print(poem.to_pandas())
136 frames
/usr/local/lib/python3.10/dist-packages/zmq/backend/cython/socket.cpython-310-x86_64-linux-gnu.so in zmq.backend.cython.socket.Socket.__reduce_cython__()
TypeError: no default __reduce__ due to non-trivial __cinit__
The text was updated successfully, but these errors were encountered:
If you have a separate parse_func where you add type annotation to the argument, you get this strange error.
e.g.
Error:
The text was updated successfully, but these errors were encountered: