Create your first distiller client¶
First Tutorial Agent Marketplace Project Creation
The DistillerClient
module is a core component of the AI Refinery SDK, specifically engineered to connect to AIRefinery service and optimize the execution of the client-side functionalities within AI-driven environments.
Objective¶
Use the SDK to create and run an AI system to provide users with assistance on weather.
Steps¶
1. Configuration file¶
As a first step, you simply need to create a yaml file with all the required configuration. You can customize your assistant agent in this simple YAML configuration file.
utility_agents:
- agent_class: SearchAgent
agent_name: "Weather Agent"
agent_description:
This agent finds the latest updates of the weather in any state in the USA.
Do not ask this agent any question that is not related to this scope.
config:
output_style: "conversational"
contexts:
- "chat_history"
orchestrator:
agent_list:
- agent_name: "Weather Agent"
2. Python file¶
1. Project creation¶
Now, you can start the development of your assistant. The first step is to create the project. Project names should be unique under the same ACCOUNT.
from dotenv import load_dotenv
from air import login, DistillerClient
import os
load_dotenv() # This loads your ACCOUNT and API_KEY from your local '.env' file
login(
account=str(os.getenv("ACCOUNT")),
api_key=str(os.getenv("API_KEY")),
)
distiller_client = DistillerClient()
project = "weather_project"
distiller_client.create_project(
config_path="config.yaml",
project=project
)
2. Connecting to a project¶
After the project is successfully created, you will be able to connect using the project name and a unique user id (uuid) of your choice, using the interacitve()
session:
from dotenv import load_dotenv
from air import login, DistillerClient
import os
load_dotenv() # This loads your ACCOUNT and API_KEY from your local '.env' file
login(
account=str(os.getenv("ACCOUNT")),
api_key=str(os.getenv("API_KEY")),
)
distiller_client = DistillerClient()
response = distiller_client.interactive(
project="weather_project",
uuid="test_user",
)
If a prior version is desired, you can specify the project version as follows:
from dotenv import load_dotenv
from air import login, DistillerClient
import os
load_dotenv() # This loads your ACCOUNT and API_KEY from your local '.env' file
login(
account=str(os.getenv("ACCOUNT")),
api_key=str(os.getenv("API_KEY")),
)
distiller_client = DistillerClient()
response = distiller_client.interactive(
project="weather_project",
uuid="test_user",
project_version="4"
)
We recommend that once a project is created and the configuration yaml file does not need to be updated, there is no need to keep using distiller_client.create_project()
everytime a new user is connecting to the project.