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

Tool 2.0 API Draft #642

Open
wants to merge 75 commits into
base: main
Choose a base branch
from
Open

Tool 2.0 API Draft #642

wants to merge 75 commits into from

Conversation

acedward
Copy link
Contributor

@acedward acedward commented Nov 6, 2024

Generate AI Documentation

image Note: Python has some issues, just a placeholder

HTML Code:
https://gist.github.com/acedward/1cd956be2cadc3e2fa7cda27f27e2555

Execute Custom Code

Creates in-memory ShinkaiTool::Deno

curl -XPOST http://localhost:9950/v2/tool_execution \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva'  \
-H "Content-Type: application/json" \
-d '{ "tool_router_key": "deno:::some-name" , "parameters": { "code": "function main() { console.log(1); return { \"data\": \"batata\" }; } " } }'

"batata"%

Generate Executable Code

Paste the generated documentation and add custom calls

/* generated documentation code */

(async () => {
    const a= await calculator('add', 10, 20);
    console.log({a});
    const b= await shinkaiToolFoobar('hey');
    console.log({b});
})();

In this example:

  • calculator is anShinkaiTool::Internal
  • shinkaiToolFoobar is a standard ShinkaiTool::JS

Run

BEARER=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva \
deno run --allow-env --allow-net --allow-read some.ts
{ a: { result: 30 } }
{ b: { data: { message: "hello world foobar" } } }

acedward and others added 30 commits November 6, 2024 20:00
# Conflicts:
#	shinkai-bin/shinkai-node/Cargo.toml
#	shinkai-libs/shinkai-lancedb/Cargo.toml
#	shinkai-libs/shinkai-tools-primitives/Cargo.toml
# Conflicts:
#	shinkai-bin/shinkai-node/Cargo.toml
# Conflicts:
#	shinkai-bin/shinkai-node/Cargo.toml
#	shinkai-libs/shinkai-lancedb/Cargo.toml
#	shinkai-libs/shinkai-tools-primitives/Cargo.toml
@nicarq nicarq marked this pull request as ready for review November 15, 2024 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants