Giter Club home page Giter Club logo

alita-sdk's Introduction

Alita SDK

Alita SDK, built on top of Langchain, enables the creation of intelligent agents within the Alita Platform using project-specific prompts and data sources. This SDK is designed for developers looking to integrate advanced AI capabilities into their projects with ease.

Prerequisites

Before you begin, ensure you have the following requirements met:

  • Python 3.10
  • An active deployment of Project Alita
  • Access to personal project

Installation

First, you need to install the Langchain library. Alita SDK depends on Langchain for its core functionalities. You can install Langchain using pip:

pip install langchain

Next, clone the Alita SDK repository (assuming it's available on GitHub or another source):

git clone https://github.com/ProjectAlita/alita-sdk.git
cd alita-sdk

Install the SDK along with its dependencies:

pip install -r requirements.txt

Environment Setup

Before running your Alita agents, set up your environment variables. Create a .env file in the root directory of your project and include your Project Alita credentials:

AUTH_TOKEN=<your_api_token>
PROJECT_ID=<your_project_id> 
INTEGRATION_UID=<your_integration_uid>

Ensure you load these variables in your application:

from dotenv import load_dotenv 
load_dotenv('.env')

Basic Usage

The Alita SDK allows you to create and execute agents with ease. Here's a simple example to get you started:

import logging
from os import environ
from dotenv import load_dotenv

logging.basicConfig(level=logging.INFO)
load_dotenv('.env')
logger = logging.getLogger(__name__)

from alita_sdk.utils.streamlit import run_streamlit

try:
    import streamlit as st
except ImportError:
    logger.error("Streamlit not found, please install it using `pip install streamlit`")
    exit(1)

from alita_sdk.llms.alita import AlitaChatModel
            
# Minimal set of setting for AlitaChatModel
settings = {
    "deployment": "https://eye.projectalita.ai",
    "model": "gpt-4-0125-preview",
    "api_key": environ.get("AUTH_TOKEN"),
    "project_id": environ.get("PROJECT_ID"),
    "integration_uid": environ.get("INTEGRATION_UID"),
    
}

print(settings)
if 'messages' not in st.session_state:
    llm = AlitaChatModel(**settings)
    st.session_state.messages = []
    st.session_state.agent_executor = llm.client.application(llm, <application_id>, <application_version_id>)
    
 
run_streamlit(st)

alita-sdk's People

Contributors

arozumenko avatar aspect13 avatar mikalaib avatar lifedjik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.