Skip to main content

Overview

Julep provides a robust chat system with various features for dynamic interaction with agents. Here’s an overview of the key components and functionalities.

Features

1

Tool Integration

The chat API allows for the use of tools, enabling the agent to perform actions or retrieve information during the conversation.
2

Multi-agent Sessions

You can specify different agents within the same session using the agent parameter in the chat settings.
3

Response Formatting

Control the output format, including options for JSON responses with specific schemas.
4

Memory and Recall

Configure how the session accesses and stores conversation history and memories.
5

Document References

The API returns information about documents referenced during the interaction, useful for providing citations or sources.

Prerequisites for Using Chat API

  • Session Creation: Before using the chat API, you must create a session first. Learn more about the session object on the Session page.
  • Document (RAG) Integration: To use Document (RAG) capabilities with the chat API, create a session with the recall_options parameter configured with appropriate search parameters. For details on configuring recall_options, see the Session: Recall Options documentation.

Input Structure

  • Messages: An array of input messages representing the conversation so far.
  • Tools: (Advanced) Additional tools provided for this specific interaction.
  • Tool Choice: Specifies which tool the agent should use.
  • Memory Access: Controls how the session accesses history and memories.(recall parameter)
  • Additional Parameters: Various parameters to control the behavior of the chat. You can find more details in the Additional Parameters section.
Here’s an example of how a typical message object might be structured in a chat interaction:
Python

This object represents a message in the chat system, detailing the structure and types of data it can hold.

Additional Parameters

Usage

Here’s an example of how to use the chat API in Julep using the SDKs:
To use the Chat endpint, you always have to create a session first.
To learn more about the Session object, check out the Session page.
Check out the API reference or SDK reference (Python or JavaScript) for more details on different operations you can perform on sessions.

Response

  • Content-Type: application/json
  • Body: A MessageChatResponse object containing the full generated message(s)
Both types of responses include the following fields:
  • id: The unique identifier for the chat response
  • choices: An object of generated message completions containing:
    • role: The role of the message (e.g. “assistant”, “user”, etc.)
    • id: Unique identifier for the message
    • content: list of actual message content
    • created_at: Timestamp when the message was created
    • name: Optional name associated with the message
    • tool_call_id: Optional ID referencing a tool call
    • tool_calls: Optional list of tool calls made during message generation
    • created_at: When this resource was created as UTC date-time
    • docs: List of document references used for this request, intended for citation purposes
    • jobs: List of UUIDs for background jobs that may have been initiated as a result of this interaction
    • usage: Statistics on token usage for the completion request

Automatic Tool Calling

Julep supports automatic tool execution during chat interactions. This feature allows tools to be executed seamlessly without manual intervention, making conversations more fluid and responsive.

How It Works

  1. When auto_run_tools=true:
    • The model identifies when a tool should be used based on the conversation
    • The tool is automatically executed by Julep’s backend
    • Results are fed back to the model to continue the conversation
    • The entire process happens in a single API call
  2. When auto_run_tools=false (default):
    • The model returns tool call requests in the response
    • Your application must execute the tools manually
    • Results need to be sent back in a follow-up message

Example with Automatic Tool Execution

Tool History Management

The recall_tools parameter controls whether tool calls and their results are included when recalling conversation history:
  • recall_tools=true (default): Tool interactions are preserved in the conversation history
  • recall_tools=false: Tool calls and results are excluded from recalled messages
This is useful when you want to maintain a cleaner conversation history without the technical details of tool executions.

Finish Reasons

stop

Natural stop point or provided stop sequence reached

length

Maximum number of tokens specified in the request was reached

content_filter

Content was omitted due to a flag from content filters

tool_calls

The model called a tool

Support

If you need help with further questions in Julep: