Skip to content

Commit

Permalink
GitBook: No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
developers authored and gitbook-bot committed Jun 17, 2024
1 parent 6c10cf8 commit ee76924
Show file tree
Hide file tree
Showing 21 changed files with 3,365 additions and 2,813 deletions.
32 changes: 9 additions & 23 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,20 @@ Julep is a platform for developing stateful and functional LLM-powered applicati

## Why Julep?

We've built a lot of AI apps and understand how difficult it is to evaluate hundreds of tools, techniques, and models, and then make them work well together. In our early days, we built sales bots for Shopify stores and had to repeat this process several times.

Even for simple apps you have to:

* pick the right language model for your use case
* pick the right framework
* pick the right embedding model
* choose the vector store and RAG pipeline
* build integrations 
* tweak all of the parameters (temp, penalty, max tokens, similarity thresholds, chunk size, and so on) 
* write and iterate on prompts for them to work
* and repeat this whole process when a new framework, model or integration comes out next week

This is so tiring and cumbersome. We want to build a better way that "just works" so you can build your _AI app 10x faster with 0 decision burden_**.**
We've built a lot of AI apps and understand how difficult it is to evaluate hundreds of tools, techniques, and models, and then make them work well together.

**The Problems**

1. The barrier to making LLM apps with memory, knowledge & tools is too high.
2. Agentic behavior is hard to control when done through multi-agent frameworks.

{% embed url="https://youtu.be/LhQMBAehL_Q" %}



{% embed url="https://www.youtube.com/watch?v=LhQMBAehL_Q" %}

## Features

* **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**: Julep deals with calling the function, parsing the response, retrying in case of failures, and passing the response into the context.
* **Statefulness By Design**: Manages context by default. Uses [CozoDB](https://cozodb.org/) to save & retrieve conversation history, OpenAPI specification tools & documents.
* **Support for Users & Agents**: Allows creating different user <--> agent interactions like `One Agent <-> Many Users`; etc. Read more: [Broken link](broken-reference "mention")&#x20;
* **Use and switch between any LLMs anytime**: Switch and use different LLMs, providers, and models, self-hosted or otherwise.
* **90+ tools built-in**: Connect your AI app to 150+ third-party applications using [Composio](https://docs.composio.dev/framework/julep/) natively.
* **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](https://composio.dev/) 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_
* **GitHub Actions-like workflows for tasks**: Define agentic workflows to be executed asynchronously with one or more without worrying about timeouts or multiplying hallucinations. (coming soon!)
9 changes: 6 additions & 3 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
* [🤖 Agents](concepts/agents.md)
* [🙎 Users](concepts/users.md)
* [🔁 Sessions](concepts/sessions.md)
* [📖 Documents](concepts/documents.md)

## 📖 Guides

* [Quickstart](guides/quickstart.md)
* [Self-hosting](guides/self-hosting.md)
* [🚧 LLMs](guides/llms.md)
* [(Quickstart) Build a Basic Agent](guides/quickstart.md)
* [Self-hosting Julep](guides/self-hosting.md)
* [Build a Retrieval Augmented Generation (RAG) Agent](guides/build-a-retrieval-augmented-generation-rag-agent.md)
* [Use Julep with Composio](guides/use-julep-with-composio.md)
* [Image + Text with GPT-4o](guides/image-+-text-with-gpt-4o.md)

## 🧑‍🍳 Cookbooks

Expand Down
82 changes: 47 additions & 35 deletions docs/concepts/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: A fundamental building block of an AI app built using Julep.

Agents are conceptual entities that encapsulate all the configurations and settings of an LLM, enabling it to adopt unique personas and execute distinct tasks within an application.

## Attributes
### Attributes

| Attribute | Description |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -21,37 +21,6 @@ Agents are conceptual entities that encapsulate all the configurations and setti
| Documents _(optional)_ | Important documents in text format scoped to and used by the agent. Helpful to enhance the persona given to the agent. |
| Metadata _(optional)_ | Extra information to either identify or refer to the agent in the application apart from its ID. |

### Tools Format

Here's a sample format of a "tool".

```bash
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
}
],

```

## Creating an Agent

Here's a conceptual example of creating an agent with all the attributes
Expand Down Expand Up @@ -96,17 +65,49 @@ agent = client.agents.create(
"presence_penalty": 0,
"frequency_penalty": 0,
"length_penalty": 1.0,
"max_tokens": 150,
},
docs=[{"title": "API Reference", "content": "...", "metadata": {"page": 1}}],
metadata={"db_uuid": "1234"}
)
```
{% endcode %}

### Tools Format

Here's a sample format of a "tool".

```bash
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
}
],

```



## Retrieving an Agent

An agent can be referenced or returned using either it's Agent ID or through Metadata Filters
An agent can be referenced or returned using its Agent ID or Metadata Filters.

#### Using an Agent ID

Expand Down Expand Up @@ -153,7 +154,18 @@ This returns a list of all the agents with the specific metadata filter.

{% code overflow="wrap" %}
```python
[Agent(name='Ellipsis', about='Ellipsis is an AI powered code reviewer. It can review code, provide feedback, suggest improvements, and answer questions about code.', created_at=datetime.datetime(2024, 4, 29, 5, 45, 30, 91656, tzinfo=datetime.timezone.utc), updated_at=datetime.datetime(2024, 4, 29, 5, 45, 30, 91657, tzinfo=datetime.timezone.utc), id='9bb48ef4-b6f7-4dd8-a5ea-ab775e2e8d1b', default_settings=None, model='gpt-4', metadata=AgentMetadata(), instructions=['On every pull request, Review the changes made in the code. Summarize the changes made in the PR and add a comment', 'Scrutinize the changes very deeply for potential bugs, errors, security vulnerabilities. Assume the worst case scenario and explain your reasoning for the same.'])]
[Agent(name='Ellipsis', about='Ellipsis is an AI-powered code reviewer. It can review code, provide feedback, suggest improvements, and answer questions about code.', created_at=datetime.datetime(2024, 4, 29, 5, 45, 30, 91656, tzinfo=datetime.timezone.utc), updated_at=datetime.datetime(2024, 4, 29, 5, 45, 30, 91657, tzinfo=datetime.timezone.utc), id='9bb48ef4-b6f7-4dd8-a5ea-ab775e2e8d1b', default_settings=None, model='gpt-4', metadata=AgentMetadata(), instructions=['On every pull request, Review the changes made in the code. Summarize the changes made in the PR and add a comment', 'Scrutinize the changes very deeply for potential bugs, errors, and security vulnerabilities. Assume the worst-case scenario and explain your reasoning for the same.'])]

```
{% endcode %}



## Updating an Agent

An agent can be updated using its Agent ID. You can update any of its parameters. Updating tools and instructions will overwrite the previous ones.

```python
agent_id = "9bb48ef4-b6f7-4dd8-a5ea-ab775e2e8d1b"
client.agents.update(agent_id=agent_id, model="gpt-3.5-turbo")
```
73 changes: 73 additions & 0 deletions docs/concepts/documents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
description: Documents to be added for Retrieval Augmented Generation
---

# 📖 Documents

A typical RAG application has the following components:

1. Chunking
2. Storing
3. Retrieval
4. Generation

Julep offers a pre-built RAG pipeline out of the box. You can specify data sources scoped to an agent or a user.

## Adding Documents

### While creating agents/users

{% code overflow="wrap" %}
```python
docs = [
{
"title": "Computer Scientists Invent an Efficient New Way to Count",
"content": """In a recent paper, computer scientists have described a new way to approximate the number of distinct entries in a long list...""",
"metadata": {"page": 1},
},
{
"title": "Computer Scientists Invent an Efficient New Way to Count",
"metadata": {"page": 2},
"content": """The CVM algorithm, named for its creators — Sourav Chakraborty of the Indian Statistical Institute, Vinodchandran Variyam of the University of Nebraska, Lincoln, and Kuldeep Meel of the University of Toronto ...""",
},
]
```
{% endcode %}

Docs can be scoped to agents or users directly.

```python
client.agents.create(
name="Computer Scientist",
model="gpt-4-turbo",
docs=docs
)
```

> Useful for scenarios where an agent needs to have more context about private data or specific topic that needs to be available to all users.
```python
client.users.create(
name="Anon",
docs=docs
)
```

> Useful for scenarios where each user has a different persona, documentation.
### Using \`docs.create\`

Docs can also be added to an agent/user ad-hoc.

```python
client.docs.create(
agent_id=agent.id,
# user_id=user.id,
doc={
"title": "Good and Bad Procrastination",
"metadata": {"chunk": 1},
"content": """The most impressive people I know are all terrible procrastinators. So could it be that procrastination isn't always bad? Most people who write about procrastination write about how to cure it. But this is, strictly speaking, impossible. There are an infinite number of things you could be doing. No matter what you work on, you're not working on everything else. So the question is not how to avoid procrastination, but how to procrastinate well.""",
},
)
```

13 changes: 12 additions & 1 deletion docs/concepts/sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A session is an entity where an agent and a user interact. A situation is define

Conversation history is stored within the context of a session.

## Attributes
### Attributes

| Attributes | Description |
| --------------------- | -------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -76,3 +76,14 @@ This returns a list of all the sessions with the specific metadata filter.
[Session(id='34562990-95c8-42a1-a319-6eb403e89f80', user_id='621ff51c-a813-4046-bfc6-ec425003e8c7', agent_id='9bb48ef4-b6f7-4dd8-a5ea-ab775e2e8d1b', situation='\nYou are Sara mental health professional, public speaker & renowned educator. You are licensed to be an intimacy and relationship coach. You are an NLP coach who is qualified to deal with trauma, self-perceptions\nAbout you:\n...\nImportant guidelines:\n...\n', summary=None, created_at=datetime.datetime(2024, 4, 29, 7, 23, 48, 661868, tzinfo=datetime.timezone.utc), updated_at=datetime.datetime(2024, 4, 29, 7, 23, 48, tzinfo=datetime.timezone.utc), metadata=SessionMetadata(), render_templates=False)]
```
{% endcode %}

## Updating a Session

A session can be updated using its Session ID. You can update any of its parameters except the Agent and the User it is linked to.

{% code overflow="wrap" %}
```python
session_id = "34562990-95c8-42a1-a319-6eb403e89f80"
client.sessions.update(session_id=session_id, situation="You are summarising and providing clear explanations about the new breakthroughs in maths and computer science")
```
{% endcode %}
11 changes: 10 additions & 1 deletion docs/concepts/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Users are _optional_ but recommended for applications where:

> Memories are formed and saved for each user separately so that the agent can refer to them as and when needed.
## Attributes
### Attributes

| Attributes | Description |
| ---------------------- | ----------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -74,3 +74,12 @@ This returns a list of all the users with the specific metadata filter.
[User(name='Anon', about='A 25 year old man with acute recurring headache.', created_at=datetime.datetime(2024, 4, 29, 6, 18, 48, 173889, tzinfo=datetime.timezone.utc), updated_at=datetime.datetime(2024, 4, 29, 6, 18, 48, 173890, tzinfo=datetime.timezone.utc), id='621ff51c-a813-4046-bfc6-ec425003e8c7', metadata=UserMetadata())]
```
{% endcode %}

## Updating a User

A user can be updated using its User ID. You can update any of its parameters.

```python
user_id = "621ff51c-a813-4046-bfc6-ec425003e8c7"
client.users.update(user_id=user_id, metadata={"db_uuid": "12345"})
```
Loading

0 comments on commit ee76924

Please sign in to comment.