Skip to main content

SDK for building langchain agents using resouces from Alita

Project description

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:

pip install alita-sdk
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"),
    
}

agent_id = 1  # Created Agent ID in Alita Platform
agent_version_id = 1

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, agent_id, agent_version_id)


run_streamlit(st)

Project details


Release history Release notifications | RSS feed

This version

0.2.5

Download files

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

Source Distribution

alita_sdk-0.2.5.tar.gz (39.9 kB view details)

Uploaded Source

Built Distribution

alita_sdk-0.2.5-py3-none-any.whl (51.3 kB view details)

Uploaded Python 3

File details

Details for the file alita_sdk-0.2.5.tar.gz.

File metadata

  • Download URL: alita_sdk-0.2.5.tar.gz
  • Upload date:
  • Size: 39.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for alita_sdk-0.2.5.tar.gz
Algorithm Hash digest
SHA256 6ecf34f39946260e11139eb2e953302217cb2aa4e761af9db7218a0e21e0bcd3
MD5 76bfdf3b267730bb696fe4d54ef93e56
BLAKE2b-256 31bdaac08b53f504be00a2228b22e23b656910d026e30571ade33ab8f434ccf1

See more details on using hashes here.

File details

Details for the file alita_sdk-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: alita_sdk-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 51.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.11

File hashes

Hashes for alita_sdk-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1f541f0792aea9d1e61d5daeeb33e0ead7c9f3d7331664b87a74dd7f850a3c06
MD5 f80be8776ee2f1315146aef6cadf4491
BLAKE2b-256 090353ccd7d3b1b4a20bc7f1f258b2eee9f797a6a3b306078ac9ea5750558669

See more details on using hashes here.

Supported by

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