Skip to content

Demonstrates various AI functionalities using Spring AI, including chat responses, JSON data handling, image creation and description, real-time data loading, text-to-speech, and vector store usage.

Notifications You must be signed in to change notification settings

stylepatrick/spring-ai-chat-bot

Repository files navigation

Spring AI Chat Bot

This project demonstrates various AI functionalities using Spring AI. It includes capabilities for generating chat responses, handling JSON formatted data, creating images, describing images, loading real-time data via APIs with Open AI Functions, generating speech from text, and utilizing a vector store for custom data.

API POST-Requests:

General Message to AI

  • URL: http://localhost:8080/api/generalMessage
  • Description: Sends a general message to AI for a response. General Message

Get Biggest Customers

  • URL: http://localhost:8080/api/biggestCustomers
  • Description: Retrieves the biggest customers for a given company in JSON format. Biggest Customers

Get Headquarters for a Company

  • URL: http://localhost:8080/api/companyHeadquarters
  • Description: Gets the headquarters of a given company in JSON format. Company Headquarters

Generate an Image from Text

  • URL: http://localhost:8080/api/image
  • Description: Generates an image from a given text using DALLE. Image Generation

Load Real-Time Data via API

  • URL: http://localhost:8080/api/weatherService
  • Description: Uses AI functions to load actual data from an API request and generate a response. Weather Service

Describe an Image

  • URL: http://localhost:8080/api/describeImage
  • Description: Uses OpenAI vision to describe the content of an image. Image Description

Generate Speech from Text

  • URL: http://localhost:8080/api/talk
  • Description: Generates speech from a given text. Text to Speech

Describe an Image with Speech

  • URL: http://localhost:8080/api/describeImageWithSpeech
  • Description: Describes an image with generated speech. Image Description with Speech

Use a Vector Store for Custom Data

  • URL: http://localhost:8080/vectorstore/message
  • Description: Uses a vector store to build embeddings on custom data. Vector Store Message

Vector Store Setup in PostgreSQL

CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TABLE IF NOT EXISTS vector_store (
    id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
    content text,
    metadata json,
    embedding vector(1536)
);

CREATE INDEX ON vector_store USING HNSW (embedding vector_cosine_ops);

About

Demonstrates various AI functionalities using Spring AI, including chat responses, JSON data handling, image creation and description, real-time data loading, text-to-speech, and vector store usage.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages