SylphAI-Inc / AdalFlow

AdalFlow: The “PyTorch” library to auto-optimize any LLM tasks.
http://adalflow.sylph.ai/
MIT License
1.32k stars 116 forks source link

[bug] failed to parse list[int] in dataclass #154

Closed liyin2015 closed 1 month ago

liyin2015 commented 1 month ago

@dataclass class AnswererOutput(DataClass): """Model to represent the output of the answerer."""

answer: str = field(metadata={"desc": "The answer to the user question."})
pmids: list[int] = field(metadata={"desc": "The PMIDs of the relevant articles used to answer."})

Some condition check failed in the parsing

# 2024-07-18 18:30:34 - outputs - ERROR - [outputs.py:282:call] - Error in parsing JSON to JSON: 'str' object has no attribute '__args__'
# 2024-07-18 18:30:34 - generator - ERROR - [generator.py:183:_post_call] - Error processing the output: 'str' object has no attribute '__args__'
# 2024-07-18 18:30:34 - generator - INFO - [generator.py:240:call] - output: GeneratorOutput(data=None, error="'str' object has no attribute '__args__'", usage=None, raw_response='```json\n{\n    "answer": "CD70 is a 70K glycoprotein and ligand for CD28 and CTLA-4. It plays a role in T cell costimulation and is expressed on resting monocytes and dendritic cells, and on activated, but not resting, T, NK and B lymphocytes.",\n    "pmids": [\n        7694153,\n        37849799,\n        7706706,\n        26359318,\n        31678777,\n        16272354\n    ]\n}\n```', metadata=None)
#