openai-assistants-quickstart  by openai

Next.js template for OpenAI Assistants API

created 1 year ago
1,918 stars

Top 23.2% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides a quick-start template for integrating the OpenAI Assistants API into a Next.js application. It demonstrates core features like streaming responses, tool usage (code interpreter, file search), and function calling, serving as a foundational example for developers building AI-powered conversational interfaces.

How It Works

The project leverages Next.js for its frontend and API routes. The core chat logic resides in app/components/chat.tsx, handling user message submission, streaming responses from the Assistants API, and managing function call execution. Backend API routes, prefixed with api/assistants/threads, manage thread creation, message posting, and function call result submission. This architecture separates concerns, allowing for clear implementation of asynchronous AI interactions within a familiar web framework.

Quick Start & Requirements

  • Install dependencies: npm install
  • Run development server: npm run dev
  • Requires an OpenAI API key, set via OPENAI_API_KEY environment variable or in a .env file.
  • Access the application at http://localhost:3000.
  • Official documentation and examples are available within the repository.

Highlighted Details

  • Demonstrates streaming responses for real-time chat.
  • Includes examples for function calling and file search capabilities.
  • Provides a full-featured example combining all Assistants API features.
  • Core chat component (chat.tsx) and file viewer (file-viewer.tsx) are designed for direct reuse.

Maintenance & Community

This is an official OpenAI quickstart repository. Feedback can be provided via a linked form.

Licensing & Compatibility

The repository is licensed under the MIT License, permitting commercial use and integration into closed-source projects.

Limitations & Caveats

The project is a quickstart template and may require further development for production-ready applications. Specific error handling and advanced state management might need to be implemented by the user.

Health Check
Last commit

4 months ago

Responsiveness

Inactive

Pull Requests (30d)
3
Issues (30d)
0
Star History
76 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.