chore: Lazy import jsonschema library (#1596)
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
This commit is contained in:
parent
5489e8b6fb
commit
9c8f763aa8
1 changed files with 23 additions and 4 deletions
|
|
@ -4,7 +4,6 @@ from typing import Any, Protocol, overload
|
|||
|
||||
import anyio.lowlevel
|
||||
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
|
||||
from jsonschema import SchemaError, ValidationError, validate
|
||||
from pydantic import AnyUrl, TypeAdapter
|
||||
from typing_extensions import deprecated
|
||||
|
||||
|
|
@ -376,6 +375,8 @@ class ClientSession(
|
|||
logger.warning(f"Tool {name} not listed by server, cannot validate any structured content")
|
||||
|
||||
if output_schema is not None:
|
||||
from jsonschema import SchemaError, ValidationError, validate
|
||||
|
||||
if result.structuredContent is None:
|
||||
raise RuntimeError(
|
||||
f"Tool {name} has an output schema but did not return structured content"
|
||||
|
|
|
|||
Loading…
Reference in a new issue