You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today we create a series of wrappers around the base set of lnd gRPC API endpoints. This works well for simple calls like addinvoice that have simple inputs, but for other calls, we want to be able to give more context to the agent in form of a better input schema.
As an example, consider the new_address tool. The input is actually an enum of the address type with the following values: WITNESS_PUBKEY_HASH, TAPROOT_PUBKEY, etc, etc. We can define a more structred input that looks something like:
classAddrTypes(Enum):
TAPROOT_PUBKEY=0WITNESS_PUBKEY_HASH=1classNewAddrSchema(BaseModel):
addr_type: AddrTypes=Field("the type of address to create")
Then each time we use the @tool decorator, we also pass the schema for the input like @tool(args_schema=NewAddrSchema).
For other calls that need more arguments, like finding a route on LN to a dest, then we can use a similar pattern to be able to profile few-shot examples for each of the fields, and also validate them.
The text was updated successfully, but these errors were encountered:
Today we create a series of wrappers around the base set of lnd gRPC API endpoints. This works well for simple calls like
addinvoice
that have simple inputs, but for other calls, we want to be able to give more context to the agent in form of a better input schema.Some examples of this are here: https://python.langchain.com/docs/modules/agents/tools/how_to/tool_input_validation
As an example, consider the
new_address
tool. The input is actually an enum of the address type with the following values:WITNESS_PUBKEY_HASH
,TAPROOT_PUBKEY
, etc, etc. We can define a more structred input that looks something like:Then each time we use the
@tool
decorator, we also pass the schema for the input like@tool(args_schema=NewAddrSchema
).For other calls that need more arguments, like finding a route on LN to a dest, then we can use a similar pattern to be able to profile few-shot examples for each of the fields, and also validate them.
The text was updated successfully, but these errors were encountered: