Created
July 1, 2024 18:20
-
-
Save Dhravya/38d1f86fcd0e2165eb7daa6424353ed8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await runWithTools(env.AI, "@hf/nousresearch/hermes-2-pro-mistral-7b", { | |
messages: [ | |
{ role: "system", content: "Put user given values in KV" }, | |
{ role: "user", content: prompt }, | |
], | |
tools: [ | |
{ | |
name: "KV update", | |
description: "Update a key-value pair in the database", | |
parameters: { | |
type: "object", | |
properties: { | |
key: { | |
type: "string", | |
description: "The key to update", | |
}, | |
value: { | |
type: "string", | |
description: "The value to update", | |
}, | |
}, | |
required: ["key", "value"], | |
}, | |
async function({ key, value }) { | |
const response = await env.KV.put(key, value); | |
return `Successfully updated key-value pair in database: ${response}`; | |
}, | |
}, | |
], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment