Skip to content

An example application that demonstrates how to evaluate the effectiveness of AI application behavior

Notifications You must be signed in to change notification settings

rd-1-2022/ai-azure-openai-evaluation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Spring AI Application with Azure OpenAI

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

There is optional message parameter whose default value is "Tell me a joke".

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

Prerequisite

Before using the AI commands, 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.openai.api-key that you should set to the value of the API Key obtained from openai.com.

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>

Building and running

./mvnw spring-boot:run

Access the endpoint

To get a response to the default request of "Tell me a joke"

curl http://localhost:8080/ai/simple

A sample response is

Why don't scientists trust atoms?

Because they make up everything!

Now using the text request parameter

curl --get  --data-urlencode 'message=Tell me a joke about a cow.' http://localhost:8080/ai/simple 

A sample response is

Why did the cow go to outer space? To see the moooon!

About

An example application that demonstrates how to evaluate the effectiveness of AI application behavior

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published