import PromptFoundry from '@prompt-foundry/typescript-sdk';
const client = new PromptFoundry({
apiKey: process.env['PROMPT_FOUNDRY_API_KEY'], // This is the default and can be omitted
});
async function main() {
const tool = await client.tools.create({
description: 'description',
name: 'name',
parameters: { foo: 'bar' },
});
console.log(tool.id);
}
main();import os
from prompt_foundry_python_sdk import PromptFoundry
client = PromptFoundry(
# This is the default and can be omitted
api_key=os.environ.get("PROMPT_FOUNDRY_API_KEY"),
)
tool = client.tools.create(
description="description",
name="name",
parameters={
"foo": "bar"
},
)
print(tool.id)curl --request POST \
--url https://api.promptfoundry.ai/sdk/v1/tools \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"parameters": {}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.promptfoundry.ai/sdk/v1/tools",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'parameters' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.promptfoundry.ai/sdk/v1/tools"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.promptfoundry.ai/sdk/v1/tools")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptfoundry.ai/sdk/v1/tools")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"parameters": {}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Creates tool
Data needed to create a new tool
import PromptFoundry from '@prompt-foundry/typescript-sdk';
const client = new PromptFoundry({
apiKey: process.env['PROMPT_FOUNDRY_API_KEY'], // This is the default and can be omitted
});
async function main() {
const tool = await client.tools.create({
description: 'description',
name: 'name',
parameters: { foo: 'bar' },
});
console.log(tool.id);
}
main();import os
from prompt_foundry_python_sdk import PromptFoundry
client = PromptFoundry(
# This is the default and can be omitted
api_key=os.environ.get("PROMPT_FOUNDRY_API_KEY"),
)
tool = client.tools.create(
description="description",
name="name",
parameters={
"foo": "bar"
},
)
print(tool.id)curl --request POST \
--url https://api.promptfoundry.ai/sdk/v1/tools \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"parameters": {}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.promptfoundry.ai/sdk/v1/tools",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'parameters' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.promptfoundry.ai/sdk/v1/tools"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.promptfoundry.ai/sdk/v1/tools")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptfoundry.ai/sdk/v1/tools")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"parameters": {}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Body
The name of the tool to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
^[a-zA-Z0-9_-]{1,64}$A description of what the tool does, used by the model to choose when and how to call the tool.
The parameters the functions accepts, described as a JSON Schema object. This schema is designed to match the TypeScript Record<string, unknown>, allowing for any properties with values of any type.
Show child attributes
Show child attributes
Response
Successful operation
The initial messages to be included with your call to the LLM API.
The name of the tool to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
^[a-zA-Z0-9_-]{1,64}$A description of what the tool does, used by the model to choose when and how to call the tool.
The parameters the functions accepts, described as a JSON Schema object. This schema is designed to match the TypeScript Record<string, unknown>, allowing for any properties with values of any type.
Show child attributes
Show child attributes
Was this page helpful?