Skip to main content

AI Refinery™ by Accenture SDK for developing and executing AI multi-agent solutions.

Project description

AI Refinery™ SDK

Python 3.12+

Get Your API Key from AI Refinery

To start using AI Refinery™, you must first create an account and obtain an API key. Contact us through AI Refinery™ official website to submit your request and start your journey with AI Refinery™ SDK.

Introduction

AI Refinery™ by Accenture is a Cloud Service for developing and executing AI multi-agent solutions. It is a platform designed to help organizations:

  • Adopt and customize large language models (LLMs) to meet specific business needs.

  • Integrate generative AI across various enterprise functions using a robust AI stack.

  • Foster continuous innovation with minimal human intervention.

  • Ensure seamless integration and ongoing advancements in AI capabilities within your projects.

The AI Refinery™ SDK is engineered to facilitate the development of AI solutions by leveraging features supported by AI Refinery such as:

  • The Distiller Framework: A framework designed to streamline complex workflows by orchestrating various agents that handle different tasks.
  • Inference API: An Api designed to seamlessly connect to any Language Model supported by AI Refinery™.
  • Knowledge Extraction: An API that is designed to extract knowledge from various formats of input documents containing text, tables, and figures.

Documentation

Comprehensive documentation for the SDK is available on the official documentation website.

All the APIs integrated in the AI Refinery™ SDK are detailed in API page.

Installation

We recommend using a MacOS or a Linux system to install the SDK. For Windows setup, we recommend using WSL (Windows Subsystem Linux), a Linux kernel you can access from Windows. For instructions on installing WSL, please visit this page. Please use Ubuntu Distro 22.04 or above.

pip install airefinery-sdk

Examples

1. Design your Stock Investment Strategy Advisor

This example uses the AI Refinery™ SDK to create and run an AI system that can provide suggestions on investing in stocks. This example demonstrates:

  • How to manage AI agents using a "Directed Acyclic Graph (DAG)" workflow representation.
  • Usecases of AI Refinery™ UtilityAgent and SuperAgent.
  • AI Agent parallel processing, allowing all tasks to begin execution as soon as they receive the necessary input information.

2. Integrate Your Custom Python Functions with the Tool Use Agent

The Tool Use Agent is a utility agent designed to perform function calls using provided tools. It enables dynamic execution of functions based on user queries, allowing for a flexible and extensible system. By integrating both built-in and custom tools, the agent can process a wide range of tasks—from simple calculations to complex data processing.

3. Integrate Responsible AI (RAI) into your project

The RAI module is a Responsible AI framework designed to help you define, load, and apply safety or policy rules to user queries via a Large Language Model (LLM). This module automatically applies system base rules for RAI checks and allows users to create and add custom rules for specific needs.

4. Process your documents to extract the knowledge for your project

This exmaple introduces The Knowledge Extraction API that allows you to send a document and then extract the knowledge/information contained within the documents. This example demonstrates:

  • How to perform knowledge extraction tasks from your PPTX, PDF, DOCX, PPT, and DOC files.
  • The DocumentProcessingClient.
  • How to construct a knowledge database for your project.

5. For more examples, check all our tutorials here.

Quickstart

  1. Create your first project
  • Create a directory named sdk-project.
  • Inside thesdk-project directory, create a Python file named example.py to place the Python code needed to run the SDK Distiller client.
  • Also, within the sdk-project directory, create a YAML file named example.yaml to provide your project configuration.

This gives you the following project structure:

sdk-project/  
│  
├── example.py  
├── example.yaml
  1. Configure your project with a single YAML file

You can start by configuring the orchestrator for this project to have access to

  • A CustomAgent with the name Assistant Agent that you implement and add to executor_dict executor_dict
  • An AIRefienry built-in utility agent named Search Agent. that you can call and use as-is

The settings for each of these utility agents are specified under utility_agents. You have the flexibility to expand your project based on your requirements. You can add additional custom agents that you define in the future or integrate built-in agents from our agent library.

orchestrator:
  # Agent name list that the Orchestrator would route the user's queries to
  agent_list:
    - agent_name: "Assistant Agent"
    - agent_name: "Search Agent"

# List of all utility_agents active in the project
utility_agents:

  # Agent 1 configuration
  - agent_class: CustomAgent
    agent_name: "Assistant Agent"
    agent_description: "The Assistant Agent helps the users in their projects."
    config: {}

  # Agent 2 configuration
  - agent_class: SearchAgent
    agent_name: "Search Agent"
  1. Create you first AIRefinery client

AsyncAIRefinery API creates a distiller client. This client will interface with the AI Refinery™ service to run your project. Below is a function that sets up the distiller client. Here's what it does:

  • Authenticate using AIREFINERY_API_KEY from your os envenvironment variables.
  • Defines the simple_agent function that will cover the scope of the Assistant Agent using AI Refinery™ Inference-as-a-service.
  • Instantiates a AsyncAIRefinery.
  • Creates a project named my_first_project using the configuration specified in the example.yaml file.
  • Adds the simple_agent to the executor_dict under the name Assistant Agent.
  • Runs the project in interactive mode.
import asyncio
import os

from air import AsyncAIRefinery

API_KEY =str(os.getenv("AIREFINERY_API_KEY"))

async def simple_agent(query: str):

    prompt = "You are an AI assistant that helps users navigate their projects."
    client = AsyncAIRefinery(api_key=API_KEY)

    response = await client.chat.completions.create(
        messages=[{"role": "user", "content": prompt}],
        model="meta-llama/Llama-3.1-70B-Instruct",
    )
    return response.choices[0].message.content

async def distiller_client_test():
    client = AsyncAIRefinery(api_key=API_KEY)
    project_name = "my_first_project"

    # upload your config file to register a new distiller project
    client.distiller.create_project(config_path="example.yaml", project=project_name) 

    # Define a mapping between your custom agent to Callable.
    # When the custom agent is summoned by the super agent / orchestrator,
    # distiller-sdk will run the custom agent and send its response back to the
    # multi-agent system.
    executor_dict = {
        "Assistant Agent": simple_agent,
    }
    async with client.distiller(
        project=project_name,
        uuid="test_user",
        executor_dict=executor_dict,
    ) as dc:
        responses = await dc.query("Hello")
        async for response in responses:
            print(response["content"])  

if __name__ == "__main__":

    asyncio.run(distiller_client_test())

Execution

To execute my_first_project, run the following commands on your terminal:

cd sdk-project/
python example.py

Running these commands will create your project on the AI Refinery™ server and run your Distiller client.

Releases & Versioning

airefinery-sdk is currently on version 1.MINOR.PATCH.

The airefinery-sdk package defines the main interfaces and runtime logic for the entire AIRefinery Platform. To maintain stability, we will clearly announce any breaking changes in advance and reflect them through appropriate version updates and deprecation announcement. As a rule, any changes that break compatibility in stable parts of the API will result in a minor or major version update, depending on the scope of the change.

Minor version increases will occur for:

  • Introduction of new agents or capabilities

  • Additions to supported features

Patch version increases will occur for:

  • Bug fixes

  • Minor improvements or refinements that do not affect API stability

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airefinery_sdk-1.21.0.tar.gz (132.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

airefinery_sdk-1.21.0-py3-none-any.whl (183.8 kB view details)

Uploaded Python 3

File details

Details for the file airefinery_sdk-1.21.0.tar.gz.

File metadata

  • Download URL: airefinery_sdk-1.21.0.tar.gz
  • Upload date:
  • Size: 132.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for airefinery_sdk-1.21.0.tar.gz
Algorithm Hash digest
SHA256 b7e7f0a774f15e0d963a6173961bb530c9a6e47142fec9bbaa957e656abf3601
MD5 b223a6da25d53d497cac4a9a2a5814d8
BLAKE2b-256 60fa7731976b0da348ec23c7145b47d6db03a8c43d7b4055cd2310b0db894639

See more details on using hashes here.

Provenance

The following attestation bundles were made for airefinery_sdk-1.21.0.tar.gz:

Publisher: workflow.yml on Accenture/airefinery-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file airefinery_sdk-1.21.0-py3-none-any.whl.

File metadata

  • Download URL: airefinery_sdk-1.21.0-py3-none-any.whl
  • Upload date:
  • Size: 183.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for airefinery_sdk-1.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3149b1875b5a33d35ef122d1962961ea224562ba869b1d54c37f7cecc92b18b
MD5 e1e0bf939a10f4fab51204d4968ec4fd
BLAKE2b-256 4d311a8a17c6fe6db5de4c631aa09c7f564e8bd16b6ca836f3abde2cb7777c5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for airefinery_sdk-1.21.0-py3-none-any.whl:

Publisher: workflow.yml on Accenture/airefinery-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page