Assistant Builder

OpenAI's persistent assistants

Build persistent AI assistants using OpenAI's Assistants API with file handling, code execution, and long-term memory.
Advanced stateful assistants with tool capabilities beyond simple chat interactions.

โ† Back to Home
๐Ÿค– Assistant Builder
1. Upload Movie File
Upload file to OpenAI
2. Create Vector Store
Create searchable database from uploaded file
3. Create Assistant
Create movie recommendation AI assistant
Query the AI assistant about movie recommendations
๐Ÿ› ๏ธ Resource Management
๐Ÿ—‘๏ธ Cleanup Options
๐Ÿ–ฅ๏ธ Assistant Console
๐Ÿš€ Ready to build your AI assistant...
๐Ÿ“– OpenAI Assistants API Implementation
๐ŸŽฏ OpenAI Assistants API

Complete implementation of OpenAI's Assistants API in Kotlin with Spring Boot. Creates intelligent AI assistants with file search capabilities.

๐Ÿ”ง Architecture
  • RAG Pipeline: File โ†’ Vector Store โ†’ Assistant โ†’ Chat
  • Async Operations: Coroutines with SSE progress tracking
  • Session Management: Smart resource detection
  • Bootstrap UI: Real-time updates via Server-Sent Events
๐Ÿ’ป Core Implementation
// Upload & Index
val file = openAIAssistant.uploadFile(
    fileBytes = movieFile.toByteArray(),
    filename = "movies.txt", 
    purpose = "assistants"
)

// Create Vector Store
val vectorStore = openAIAssistant.createVectorStore(
    name = "Movie Database",
    fileIds = listOf(file.id)
)
๐Ÿค– Assistant Creation
// Create Assistant with File Search
val assistant = openAIAssistant.createAssistant(
    name = "Movie Expert",
    instructions = MOVIE_ASSISTANT_PROMPT,
    model = Models.Chat.GPT_4O,
    tools = listOf(AssistantTool("file_search")),
    vectorStoreIds = listOf(vectorStore.id)
)
๐Ÿ’ฌ Async Chat Flow
// Multi-step async conversation
val thread = assistant.createThread()
assistant.addMessageToThread(thread.id, userMessage)
val run = assistant.runAssistant(thread.id, assistant.id)

// Poll for completion
while (run.status == "in_progress") {
    delay(2000)
    runStatus = assistant.getRunStatus(thread.id, run.id)
}

val response = assistant.getMessages(thread.id)
    .data.filter { it.role == "assistant" }
    .maxByOrNull { it.createdAt }
โœจ Features
  • ๐Ÿ”„ Smart fallback (DB โ†’ general knowledge)
  • ๐ŸŽจ Bootstrap-formatted responses
  • ๐Ÿ“ก Real-time SSE progress updates
  • ๐Ÿงน Granular resource cleanup