Playground
Checking the API
Try Nenya 1
Pick a job, put in your own text and press Run. There is no sign-up and no key: the page calls the same API your code would.
The model picks a tool and fills in its arguments. Send the result back and it carries on.
Request
Settings
or press ⌘ Enter
The request goes from your browser straight to the API. We keep each request and reply for 30 days, to monitor the API for abuse and to see where the model gets things wrong. We do not train on them. Then they are deleted. Terms and privacy
Reply
The request is sent to the API as it stands, and what comes back is shown here.
The same request in code
API documentationIt follows the form as you change it. Copy it, run it, and you get what the reply panel shows. No key is needed.
curl https://api.contrastivelabs.dev/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "nenya",
"messages": [
{
"role": "system",
"content": "You are the support assistant of Fernhill, an online furniture shop. You help customers with their orders.\n\nRules:\n- Always look an order up first.\n- Use a tool whenever one fits the request, and pass exactly the values the customer gave.\n- A customer who asks for their money back gets the order'\''s total refunded.\n- If no tool fits, answer in one or two sentences.\n- Keep answers short and plain."
},
{
"role": "user",
"content": "My standing desk from order 48213 arrived with a cracked top. I would like my money back."
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_order",
"description": "Look up an order by its number.",
"parameters": {
"type": "object",
"properties": {
"order_id": {"type": "string", "description": "The order number, digits only"}
},
"required": ["order_id"]
}
}
},
{
"type": "function",
"function": {
"name": "issue_refund",
"description": "Refund an order, in full or in part.",
"parameters": {
"type": "object",
"properties": {
"order_id": {"type": "string", "description": "The order number, digits only"},
"amount": {"type": "number", "description": "Amount to refund, in pounds"},
"reason": {
"type": "string",
"enum": ["damaged", "late", "wrong_item", "other"],
"description": "Why the customer is refunded"
}
},
"required": ["order_id", "amount", "reason"]
}
}
},
{
"type": "function",
"function": {
"name": "escalate_to_human",
"description": "Hand the conversation to a person.",
"parameters": {
"type": "object",
"properties": {
"summary": {
"type": "string",
"description": "What the customer wants, in one sentence"
}
},
"required": ["summary"]
}
}
}
],
"max_tokens": 800
}'from openai import OpenAI
client = OpenAI(base_url="https://api.contrastivelabs.dev/v1", api_key="none")
system_prompt = """You are the support assistant of Fernhill, an online furniture shop. You help customers with their orders.
Rules:
- Always look an order up first.
- Use a tool whenever one fits the request, and pass exactly the values the customer gave.
- A customer who asks for their money back gets the order's total refunded.
- If no tool fits, answer in one or two sentences.
- Keep answers short and plain."""
response = client.chat.completions.create(
model="nenya",
messages=[
{"role": "system", "content": system_prompt},
{
"role": "user",
"content": "My standing desk from order 48213 arrived with a cracked top. I would like my money back.",
},
],
tools=[
{
"type": "function",
"function": {
"name": "get_order",
"description": "Look up an order by its number.",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string",
"description": "The order number, digits only",
},
},
"required": ["order_id"],
},
},
},
{
"type": "function",
"function": {
"name": "issue_refund",
"description": "Refund an order, in full or in part.",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string",
"description": "The order number, digits only",
},
"amount": {
"type": "number",
"description": "Amount to refund, in pounds",
},
"reason": {
"type": "string",
"enum": ["damaged", "late", "wrong_item", "other"],
"description": "Why the customer is refunded",
},
},
"required": ["order_id", "amount", "reason"],
},
},
},
{
"type": "function",
"function": {
"name": "escalate_to_human",
"description": "Hand the conversation to a person.",
"parameters": {
"type": "object",
"properties": {
"summary": {
"type": "string",
"description": "What the customer wants, in one sentence",
},
},
"required": ["summary"],
},
},
},
],
max_tokens=800,
)
message = response.choices[0].message
for call in message.tool_calls or []:
print(call.function.name, call.function.arguments)
if message.content:
print(message.content)import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.contrastivelabs.dev/v1", apiKey: "none" });
const systemPrompt = `You are the support assistant of Fernhill, an online furniture shop. You help customers with their orders.
Rules:
- Always look an order up first.
- Use a tool whenever one fits the request, and pass exactly the values the customer gave.
- A customer who asks for their money back gets the order's total refunded.
- If no tool fits, answer in one or two sentences.
- Keep answers short and plain.`;
const response = await client.chat.completions.create({
model: "nenya",
messages: [
{ role: "system", content: systemPrompt },
{
role: "user",
content: "My standing desk from order 48213 arrived with a cracked top. I would like my money back.",
},
],
tools: [
{
type: "function",
function: {
name: "get_order",
description: "Look up an order by its number.",
parameters: {
type: "object",
properties: {
order_id: { type: "string", description: "The order number, digits only" },
},
required: ["order_id"],
},
},
},
{
type: "function",
function: {
name: "issue_refund",
description: "Refund an order, in full or in part.",
parameters: {
type: "object",
properties: {
order_id: { type: "string", description: "The order number, digits only" },
amount: { type: "number", description: "Amount to refund, in pounds" },
reason: {
type: "string",
enum: ["damaged", "late", "wrong_item", "other"],
description: "Why the customer is refunded",
},
},
required: ["order_id", "amount", "reason"],
},
},
},
{
type: "function",
function: {
name: "escalate_to_human",
description: "Hand the conversation to a person.",
parameters: {
type: "object",
properties: {
summary: { type: "string", description: "What the customer wants, in one sentence" },
},
required: ["summary"],
},
},
},
],
max_tokens: 800,
});
const message = response.choices[0].message;
for (const call of message.tool_calls ?? []) {
console.log(call.function.name, call.function.arguments);
}
if (message.content) console.log(message.content);Does it do your job? Bring a few real examples to a call.
If Nenya 1 is close but not there, that is what fine-tuning on your own data is for.