types
is_instance_of(obj, type_hint)
¶
Check if an object is an instance of a type hint, e.g.
to check whether x is of type List[ToolMessage]
or type int
Source code in langroid/utils/types.py
to_string(msg)
¶
Best-effort conversion of arbitrary msg to str. Return empty string if conversion fails.
Source code in langroid/utils/types.py
is_callable(obj, k=1)
¶
Check if object is callable and accepts exactly k args.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
Any
|
Object to check |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if object is callable with k args, False otherwise |