Skip to content

Code Mode API and LSP #4089

@ryanpeach

Description

@ryanpeach

Enhancement

I think that LLM's will have trouble, even with schema, writing code calls like this:

await call_tool("foo", {"bar": "baz"})

What we need is to have a resource, given a list of tool names, a python API, like so:

@dataclass
class FooParams:
    bar: str

@dataclass
class FooReturns:
    baz: str

async def foo(params: FooParams) -> FooReturns:
    return FooReturns(**(await call_tool("foo", asdict(params))))

The LLM can retrieve this from a resource or a prompt with a parameter taking a list of tool names.

The code executor can have this preprended to the top of any code its executing.

Then we can run an LSP on the code before we even pass it to the execution environment and return detailed syntax errors too.

Hope this isn't a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to existing functionality. For issues and smaller PR improvements.proposalA proposal for a feature or enhancement either requiring or seeking comments on its design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions