GithubHelp home page GithubHelp logo

shehzada / ai-azure-retrieval-augmented-generation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rd-1-2022/ai-azure-retrieval-augmented-generation

0.0 0.0 0.0 92 KB

An example application that demonstrates how use Retrieval Augmented Generation with Azure OpenAI

Java 94.07% Smalltalk 5.93%

ai-azure-retrieval-augmented-generation's Introduction

Spring AI Retrieval Augmented Generation with Azure OpenAI

This project contains a web service that will accept HTTP GET requests at http://localhost:8080/ai/rag

There is optional message parameter whose default value is "What bike is good for city commuting?".

The response to the request is from the Azure OpenAI Service.

Building and running

./mvnw spring-boot:run

Access the endpoint

To get a response to the default request of "What bike is good for city commuting?"

http http://localhost:8080/ai/rag

A sample response is

{
  "info": {},
  "text": "Both the SwiftRide Hybrid and the AgileEon 9X are good options for city commuting, as they are designed for daily commutes and recreational rides. They both have efficient electric assist, integrated lights, and components that provide a comfortable and reliable cycling experience. Ultimately, the choice depends on your personal preferences and needs."
}

Now using the message request parameter to ask about a specific bike.

$  http GET localhost:8080/ai/rag message=="Tell me some details about the SwiftRide Hybrid"

A sample response is

{
    "info": {},
    "text": "The SwiftRide Hybrid is a versatile and efficient bike designed for riders who want a smooth and enjoyable ride on various terrains. It features a lightweight and durable aluminum frame, a powerful electric motor that offers a speedy assist, a removable and fully-integrated 500Wh battery, a 10-speed Shimano drivetrain, hydraulic disc brakes for precise stopping power, wide puncture-resistant tires for stability, and integrated lights for enhanced visibility. The bike is priced at $3999.99."
}

Prerequisite

Obtain your Azure OpenAI endpoint and api-key from the Azure OpenAI Service section on Azure Portal

The Spring AI project defines a configuration property named spring.ai.azure.openai.api-key that you should set to the value of the API Key obtained from Azure

Exporting an environment variables is one way to set these configuration properties.

export SPRING_AI_AZURE_OPENAI_API_KEY=<INSERT KEY HERE>
export SPRING_AI_AZURE_OPENAI_ENDPOINT=<INSERT ENDPOINT URL HERE>

ai-azure-retrieval-augmented-generation's People

Contributors

markpollack avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.