Skip to main content

Overview

In this section, we’ll cover the key concepts and components of the Julep Responses API. The Julep Responses API is designed to be compatible with OpenAI’s interface, making it easy to migrate existing applications that use OpenAI’s API to Julep.
  • The Open Responses API requires self-hosting. See the installation guide below.
  • Being in Alpha, the API is subject to change. Check back frequently for updates.
  • For more context, see the OpenAI Responses API documentation.

Components

The Responses API offers a streamlined way to interact with language models with the following key components:
  • Response ID: A unique identifier (uuid7) for each response.
  • Model: The language model used to generate the response (e.g., “claude-3.5-haiku”, “gpt-4o”, etc.).
  • Input: The prompt or question sent to the model, which can be simple text or structured input.
  • Output: The generated content from the model, which can include text, tool outputs, or other structured data.
  • Status: The current status of the response (completed, failed, in_progress, incomplete).
  • Tools: Optional tools that the model can use to enhance its response.
  • Usage: Token consumption metrics for the response.

2.1. Response Configuration Options

When creating a response, you can leverage these configuration options to tailor the experience: To know more about the roadmap of the Responses API, check out the Roadmap page.

Input Formats

The Responses API supports various input formats to accommodate different use cases:

Simple Text Input

The simplest way to interact with the Responses API is to provide a text string as input:

Structured Message Input

For more complex interactions, you can provide a structured array of messages:

Multi-modal Input

The Responses API supports multi-modal inputs, allowing you to include images or files along with text:

Tool Usage

The Responses API supports tool usage, allowing the model to perform actions like web searches, function calls, and more to enhance its response.

Relationship to Sessions

While Sessions provide a persistent, stateful way to interact with agents over multiple turns, the Responses API offers a lightweight, stateless alternative for quick, one-off interactions with language models. Here’s how they compare:
If you need to maintain context across multiple interactions but prefer the simplicity of the Responses API, you can use the previous_response_id parameter to link responses together.

Response Object Structure

The Response object is the core data structure returned by the Julep Responses API as a response to a request. It contains all the information about a generated response. It follows the OpenAI Responses API. Following is the schema of the Response object: The output array contains the actual content generated by the model, which can include text messages, tool calls (function, web search, file search, computer), and reasoning items.

Best Practices

Optimize Input Prompts

  • 1. Be Specific: Clearly define what you want the model to generate.
  • 2. Provide Context: Include relevant background information in your prompt.
  • 3. Use Examples: When appropriate, include examples of desired outputs in your prompt.

Model Selection

  • 1. Match Complexity: Use more capable models for complex tasks (e.g., reasoning, coding).
  • 2. Consider Latency: Smaller models are faster for simple tasks.
  • 3. Test Different Models: Compare results across models for optimal performance.

Tool Usage

  • 1. Provide Clear Tool Descriptions: Help the model understand when and how to use tools.
  • 2. Only Include Relevant Tools: Too many tools can confuse the model’s selection process.
  • 3. Validate Tool Outputs: Always verify the information returned from tool calls.

Next Steps