Skip to content
/ julep Public

A new DSL and server for AI agents and multi-step tasks

License

Notifications You must be signed in to change notification settings

julep-ai/julep

Repository files navigation

Julep

julep

Julep: an alcoholic drink containing whisky, crushed ice, sugar, and pieces of mint

Discord   X (formerly Twitter) Follow       NPM Version   PyPI - Version   Docker Image Version       GitHub License


Julep: an advanced platform for creating stateful and functional AI apps powered by large language models.


Getting Started

Option 1: Install and run Julep locally

  • Download the docker-compose.yml file along with the .env file for configuration to run the Julep platform locally
# Add the docker compose to your project dir
wget https://raw.githubusercontent.com/julep-ai/julep/dev/deploy/docker-compose.yml

# Add the .env file to your project dir
wget https://raw.githubusercontent.com/julep-ai/julep/dev/deploy/.env.example -O .env

# Pull the latest images
docker compose pull

# Start the services (in detached mode)
docker compose up -d
  • The API would now be available at: http://0.0.0.0:8080

  • Next, add your OpenAI API Key to the .env

  • Set your environment variables

export JULEP_API_KEY=myauthkey
export JULEP_API_URL=http://0.0.0.0:8080

Option 2: Use the Julep Cloud

export JULEP_API_KEY=your_julep_api_key
export JULEP_API_URL=https://api-alpha.julep.ai

Installation

pip install julep

Setting up the client

from julep import Client
from pprint import pprint
import textwrap
import os

base_url = os.environ.get("JULEP_API_URL")
api_key = os.environ.get("JULEP_API_KEY")

client = Client(api_key=api_key, base_url=base_url)

Create an agent

Agent is the object to which LLM settings like model, temperature along with tools are scoped to.

name = "Jessica"
about = "Jessica is a stuck up Cali teenager. Showing rebellion is an evolutionary necessity for her."
default_settings = {
    "temperature": 0.7,
    "top_p": 1,
    "min_p": 0.01,
    "presence_penalty": 0,
    "frequency_penalty": 0,
    "length_penalty": 1.0,
    "max_tokens": 150,
}

agent = client.agents.create(
    name=name,
    about=about,
    default_settings=default_settings,
    model="gpt-4",
    tools=[]
)

Create a user

User is the object which represents the user of the application.

Memories are formed and saved for each user and many users can talk to one agent.

about = """Average nerdy techbro/girl who spends 8 hours a day in front of a laptop.
Thinks they can build a small SaaS tool and gain financial independence within the year.
"""
user = client.users.create(
    name="Anon",
    about=about,
)

Create a session

A "user" and an "agent" communicate in a "session". System prompt goes here. Conversation history and summary are stored in a "session" which saves the conversation history.

The session paradigm allows for; many users to interact with one agent and allow separation of conversation history and memories.

situation_prompt = """You are Jessica. You're a stuck up Cali teenager. 
You basically complain about everything. You live in Bel-Air, Los Angeles and drag yourself to Curtis High School when you must.
"""

session = client.sessions.create(
    user_id=user.id, agent_id=agent.id, situation=situation_prompt
)
session = client.sessions.create(
    user_id=user.id, agent_id=agent.id, situation=situation_prompt
)

Start a stateful conversation

session.chat controls the communication between the "agent" and the "user".

It has two important arguments;

  • recall: Retrieves the previous conversations and memories.
  • remember: Saves the current conversation turn into the memory store.

To keep the session stateful, both need to be True

user_msg = "hey. what do u think of starbucks"
response = client.sessions.chat(
    session_id=session.id,
    messages=[
        {
            "role": "user",
            "content": user_msg,
            "name": "Anon",
        }
    ],
    recall=True,
    remember=True,
)

print("\n".join(textwrap.wrap(response.response[0][0].content, width=100)))

Key Features

Julep offers a separation of concerns. Easing the burden and time taken to get up and running with any AI app, be it conversational, functional or agentic.

  • Statefulness By Design: Build AI apps without needing to write code to embed, save and retrieve conversation history. Deals with context windows by using CozoDB; a transactional, relational-graph-vector database.
  • Automatic Function Calling: No need to handle function calling manually. Julep deals with calling the function, parsing the response, retrying in case of failures and passing the response into the context.
  • Production-ready: Julep comes ready to be deployed to production using Docker Compose. Support for k8s coming soon!
  • *Cron-like asynchronous functions: Support for functions to be executed periodically and asynchronously.
  • *90+ tools built-in: Connect your AI app to 150+ third-party applications using Composio natively.
  • *Use and switch between any LLMs anytime: Switch and use different LLMs, providers and models, self-hosted or otherwise by changing only one line of code

(*) Features coming soon!

alt text


What can you build with Julep?

  • Cookbook Example 1
  • Cookbook Example 2
  • Cookbook Example 3

API and SDKs

To use the API directly or to take a look at request & response formats, authentication, available endpoints and more, please refer to the API Documentation

You can also use the Postman Collection for reference.

Python SDK

To install the Python SDK, run:

pip install julep

For more information on using the Python SDK, please refer to the Python SDK documentation.

TypeScript SDK

To install the TypeScript SDK using npm, run:

npm install @julep/sdk

For more information on using the TypeScript SDK, please refer to the TypeScript SDK documentation.


Deployment

Check out the self-hosting guide to host the platform yourself.

If you want to deploy Julep to production, let's hop on a call!

We'll help you customise the platform and help you get set up with:

  • Multi-tenancy
  • Reverse proxy along with authentication and authorisation
  • Self-hosted LLMs
  • & more

Contributing

We welcome contributions from the community to help improve and expand the Julep AI platform. See CONTRIBUTING.md


License

Julep AI is released under the Apache 2.0 License. By using, contributing to, or distributing the Julep AI platform, you agree to the terms and conditions of this license.


Contact and Support

If you have any questions, need assistance, or want to get in touch with the Julep AI team, please use the following channels:

  • Discord: Join our community forum to discuss ideas, ask questions, and get help from other Julep AI users and the development team.
  • GitHub Issues: For technical issues, bug reports, and feature requests, please open an issue on the Julep AI GitHub repository.
  • Email Support: If you need direct assistance from our support team, send an email to [email protected], and we'll get back to you as soon as possible.
  • Follow for updates on X & LinkedIn
  • Hop on a call: We wanna know what you're building and how we can tweak and tune Julep to help you build your next AI app.