Skip to content

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
)
Once a project is created, the configuration file will be saved in the AIRefinery cloud and will be accessible to any user under the same ACCOUNT. Each project is assigned a project version number that can be used later to access that version of the account. The version number is shown once the project creation operation is successful:
Project <project_name> - version <i> has been created for <accoun_number>.

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",
)
By default, the distiller_client will connect to the latest version of the project.

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.