typesense-java
typesense-java copied to clipboard
feat(conversations): add conversation and model management APIs
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
-
New Classes for Conversation Management:
-
ConversationModel: Handles individual model operations (CRUD) -
ConversationModels: Manages model collections -
Conversation: Manages individual conversations -
Conversations: Handles conversation collections
-
-
New Schema Classes:
-
ConversationSchema: Defines conversation structure -
ConversationModelCreateSchema: Model creation parameters -
ConversationModelUpdateSchema: Model update parameters -
ConversationDeleteSchema: Deletion response structure
-
Code Changes
-
In
Client.java:- Added conversation management support
- Implemented new methods:
conversations()andconversations(String id) - Added conversation-related fields and initialization
-
In
Helper.java:- Added
createConversationCollection()for test setup - Added
createTestConversationModel()for testing - Updated
teardown()to clean up conversation resources
- Added
-
In
build.gradle:- Fixed JUnit platform configuration for CI environment
Test Updates
-
Added
ConversationModelsTest.java:- Test coverage for model CRUD operations
- Integration tests with OpenAI GPT-3.5
- Environment variable handling for API keys
PR Checklist
- [x] I have read and signed the Contributor License Agreement.