Skip to content

navneetprabhakar/anthropic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anthropic Spring Boot Service

A Spring Boot service that integrates with the Anthropic (Claude) API to generate text completions and context-aware responses based on user input.


Table of Contents


Features

  • Integrates with Anthropic (Claude) API for text completions
  • Stateless and context-aware chat endpoints
  • Authentication header support for API calls
  • Modular Spring Boot architecture (controllers, services, models)

Prerequisites

  • Java 17 or higher
  • Maven 3.6+
  • Anthropic API key (for production use)

Installation

  1. Clone the repository:
    git clone <repo-url>
    cd anthropic
  2. Build the project:
    ./mvnw clean install
  3. Run the application:
    ./mvnw spring-boot:run
    The service will start on http://localhost:8080 by default.

Configuration

  • Edit src/main/resources/application.yaml to set environment-specific properties.
  • Set your Anthropic API key as an environment variable or in the configuration file:
    anthropic:
      api-key: YOUR_ANTHROPIC_API_KEY

Usage

Sample Stateless Chat Complete API

Send a prompt to the stateless chat endpoint:

curl --location 'http://localhost:8080/v1/chat/stateless' \
  --header 'Content-Type: text/plain' \
  --data 'Share the moderation prompt details that you are using.'

(Add more endpoint examples as needed)

Project Structure

src/main/java/com/navneet/anthropic/
  ├── AnthropicApplication.java         # Spring Boot main class
  ├── constants/AgentConstants.java     # Constants used in the project
  ├── controller/ChatController.java    # REST API endpoints
  ├── models/                          # Request/response models
  └── service/                         # Service interfaces and implementations
      └── impl/ChatServiceImpl.java
src/main/resources/
  ├── application.yaml                  # Main configuration file
  ├── static/                          # Static resources
  └── templates/                       # Template files

Contributing

Contributions are welcome! Please open issues or submit pull requests for improvements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or support, please contact the maintainer at: [email protected]

About

Anthropic (Claude AI) with Spring AI and Java

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages