typesense-java icon indicating copy to clipboard operation
typesense-java copied to clipboard

feat(conversations): add conversation and model management APIs

Open tharropoulos opened this issue 1 year ago • 0 comments

Rationale

This PR introduces conversation management capabilities to the Typesense Java client, allowing developers to integrate LLM-powered conversations into their applications.

This addition enables Java developers to:

  • Configure and manage LLM models through Typesense
  • Store and retrieve conversation histories
  • Set up model-specific parameters like context windows and system prompts
  • Integrate with OpenAI and other LLM providers

Changes

Added Features

  1. New Classes for Conversation Management:

    • ConversationModel: Handles individual model operations (CRUD)
    • ConversationModels: Manages model collections
    • Conversation: Manages individual conversations
    • Conversations: Handles conversation collections
  2. New Schema Classes:

    • ConversationSchema: Defines conversation structure
    • ConversationModelCreateSchema: Model creation parameters
    • ConversationModelUpdateSchema: Model update parameters
    • ConversationDeleteSchema: Deletion response structure

Code Changes

  1. In Client.java:

    • Added conversation management support
    • Implemented new methods: conversations() and conversations(String id)
    • Added conversation-related fields and initialization
  2. In Helper.java:

    • Added createConversationCollection() for test setup
    • Added createTestConversationModel() for testing
    • Updated teardown() to clean up conversation resources
  3. In build.gradle:

    • Fixed JUnit platform configuration for CI environment

Test Updates

  1. Added ConversationModelsTest.java:
    • Test coverage for model CRUD operations
    • Integration tests with OpenAI GPT-3.5
    • Environment variable handling for API keys

PR Checklist

tharropoulos avatar Nov 07 '24 15:11 tharropoulos