Tune Assistant in Action
This guide will help you get started quickly with creating and using AI assistants.
The Assistant offers a robust framework for developers to create AI assistants tailored to their applications.
For more detailed instructions and advanced concepts, please refer to the Assistant page under Concepts.
Getting Started
To begin working with AI assistants, you have two options:
- Interactive Assistant Playground: Prototype and test Assistant functionality quickly without writing code.
- Integrate with the Assistant API:: Build Assistant functionality directly into your applications.
Option 1: Create Assistant using Playground
Follow these simple steps to create your first assistant via playground:
- Build an Assistant by Providing a Model ID: This ID will be used in all APIs.
- Set Specific Instructions: Define the instructions that the assistant needs to follow. Defines your assistant’s behavior.
- Choose the Response Model: Select a model that combines responses from multiple tools to generate the final output.
- Select the Function Calling Model: Pick a model that enables the assistant to decide which function to call.
- Pre-Set Tools: Equip your assistant with tools such as:
- Search: Enable the assistant to perform web searches (note: it cannot visit the search results).
- Image Generation: Allow the assistant to generate creative images.
- Specify Actions: Define the actions your assistant can perform. Actions serve as messengers between your LLMs and external applications, helping you:
- Interact with External Apps: Connect with outside applications using RESTful APIs by providing an OpenAPI spec.
- Retrieve Data: Fetch information from external applications, such as recent orders.
- Take Actions: Perform tasks in other applications, like sending an email.
- Function Calling: Describe your function to the model. It allows you to access real-time data and execute custom functions within a specific context.
Option 2: Create Assistant using API
This section focuses on using the Assistants API to create and manage assistants. You can view complete assistant API reference doc here.
Prerequisites
- Tune API key: Get it from View API Keys under your profile.
- Organization ID: Get it under your Organization settings or click on “Get Code” button inside playground
Create Basic Assistant
To create a new assistant, send a POST
request to the /v1/assistants
endpoint.
Required Fields:
modelName
: A unique name for your assistant within your organization.functionModel
: Specifies the model used for function calling.responseModel
: Specifies the model used for generating responses.
Required Headers:
x-tune-key
: Your Tune API key.X-Org-Id
: Your organization ID. If not provided, the default organization is used. You can find your organization ID here.
Here’s an example of creating a basic assistant:
Replace MODEL_ID
with the ID of the models you wish to use.
Managing Assistants
After creating an assistant, you might want to list all your assistants, retrieve details of a specific assistant, or delete an assistant. Here’s how you can do that using the Assistants API.
Listing Assistants
To fetch a list of your assistants, send a GET request to the /v1/assistants
endpoint.
Example Request:
Optional Query Parameters:
limit
: Maximum number of assistants to return (default is 10).order
: Order of results (asc
ordesc
).after
: Pagination token for fetching the next page.before
: Pagination token for fetching the previous page.
Example with Query Parameters:
Getting an Assistant
To retrieve details of a specific assistant, send a GET request to the /v1/assistants/{assistantId}
endpoint, replacing {assistantId}
with the ID of your assistant.
Example Request:
This request will return details such as the assistant’s modelName
, functionModel
, responseModel
, and any associated tools.
Deleting an Assistant
To delete an assistant, send a DELETE request to the /v1/assistants/{assistantId}
endpoint.
Example Request:
For more detailed guide for assistant checkout the Assistant concept page.
Next Steps
Now that you’ve created and managed a basic assistant, you can explore more advanced features and details, checkout:
- Complete Assistant Guide - Deep dive into assistant workflow, models, tools, and configurations
- Modifying Assistant: Update your assistant’s configuration as needed.
- Custom Tools Guide - Create your own functions and integrations. And using built-in tools to enhance capabilities with tools like web search, image generation etc.
- Actions Guide - Integrate external APIs and services.
- Assistant API Reference - Complete API documentation.
Was this page helpful?