Local Development
Follow these instructions to set up the project locally for development:Prerequisites
- Java JDK 21+
- Gradle (optional, as project includes Gradle Wrapper)
- Docker (optional, for containerized setup)
Steps
- Clone the repository
- Build the project
- Configure Environment Variables
application.properties
file with necessary configuration under src/main/resources
:
- Run the server
Docker Setup (Optional)
Build and run the application using Docker:Testing
Run the tests with:Key Components
API Layer
The API layer is responsible for handling HTTP requests and responses. Key files include:ResponsesController.kt
: Handles requests to the/v1/responses
endpointResponsesInputItemsController.kt
: Manages input items for responses
Service Layer
The service layer contains the business logic for the application:ModelServiceClient.kt
: Interface for model provider-specific implementationsResponsesService.kt
: Core service for handling responsesTelemetryService.kt
: Service for collecting telemetry data
Storage Layer
The storage layer manages data persistence:ResponseStore.kt
: Interface for response storageInMemoryResponseStore.kt
: In-memory implementationMongoDBResponseStore.kt
: MongoDB implementation
Tool Integration
The tools package contains implementations for built-in tools:BraveWebSearchTool.kt
: Implementation of web searchGitHubTools.kt
: GitHub integration toolsClaudeThinkTool.kt
: Claude’s think tool integration
Configuration
Application Properties
The main configuration files are:application.properties
: Default application configurationapplication-otel.properties
: OpenTelemetry configuration
API Testing
Using cURL
Debugging
Logs
By default, logs are written to the console. You can increase the log level by setting:Metrics and Health
The application exposes several endpoints for monitoring:/actuator/health
: Health check endpoint/actuator/metrics
: Metrics endpoint/actuator/info
: Application info
Contributing
We welcome contributions to OpenResponses! To contribute:- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature
) - Make your changes
- Add tests for your changes
- Run the tests (
./gradlew test
) - Commit your changes (
git commit -am 'Add my feature'
) - Push to the branch (
git push origin feature/my-feature
) - Create a new Pull Request
Troubleshooting
Common Issues
API Key Issues
If you’re having issues with API keys, ensure that:- The API key is correctly set in the
Authorization
header - The model provider header is correctly set
- The API key has the necessary permissions
MongoDB Connection Issues
If using MongoDB and experiencing connection issues:- Verify the MongoDB URI is correct
- Ensure MongoDB is running and accessible
- Check that the database name is correct