Closed NJordan72 closed 1 month ago
Interesting, I will have a look in the next bug squash (unless you want to dive in and submit a PR :) )
On Tue, May 14, 2024 at 3:24 PM NJordan72 @.***> wrote:
When working with a JSON Schema (generated from Pydantic v2) I get an error when creating a parser.
from typing import Listfrom pydantic import BaseModel from lmformatenforcer import JsonSchemaParser class TreeNode(BaseModel): name: str children: List["TreeNode"] parser = JsonSchemaParser(TreeNode.model_json_schema())
results in raise Exception("Unsupported type " + str(value_schema.type)) Exception: Unsupported type None
If I wrap the TreeNode in a simple response object everything works fine:
from typing import Listfrom pydantic import BaseModel from lmformatenforcer import JsonSchemaParser class TreeNode(BaseModel): name: str children: List["TreeNode"] class Result(BaseModel): tree: TreeNode parser = JsonSchemaParser(Result.model_json_schema())
— Reply to this email directly, view it on GitHub https://github.com/noamgat/lm-format-enforcer/issues/98, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKFA2HEZ66AHQYGCG2QWSTZCH675AVCNFSM6AAAAABHWCIJEOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4TKMRYHE2TCMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
When working with a JSON Schema (generated from Pydantic v2) I get an error when creating a parser.
results in
raise Exception("Unsupported type " + str(value_schema.type)) Exception: Unsupported type None
If I wrap the
TreeNode
in a simple response object everything works fine: