Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: use tools schema to provide more context for complex function calls #1

Open
Roasbeef opened this issue Jul 6, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Roasbeef
Copy link
Member

Roasbeef commented Jul 6, 2023

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:

class AddrTypes(Enum):
    TAPROOT_PUBKEY = 0
    WITNESS_PUBKEY_HASH = 1

class NewAddrSchema(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.

@Roasbeef Roasbeef added the enhancement New feature or request label Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant