-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
registry.resolve raises the following error
TypeError: 'Resource' object does not support item assignment
for the given example
from pydantic.main import BaseModel
import thinc
from thinc.api import Config, registry
class Resource(BaseModel):
url: str
thinc.registry.create("resources")
@thinc.registry.resources("Resource.v1")
def make_resource(
url: str,
) -> Resource:
return Resource(
url=url,
)
config = Config().from_str(
"""
[resource]
@resources = "Resource.v1"
url = "https://thinc.ai/docs/usage-config"
"""
)
resolved = registry.resolve(config)
resource = resolved["resource"]
assert resource is not NoneIf I return url in make_resource (add use str for return type instead) then it works just fine. Is it on purpose that pydantic can't be returned in registered functions?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels