Author: Julien Dubois
This demo is supporting a video called "LangChain4J - use the power of LLMs in Java!", available at https://youtu.be/x8kkjmCZTaw.
This is a Spring Boot project that demonstrates how to use LangChain4J to create Java applications using LLMs.
It contains 7 demos:
- How to generate an image using Dalle-3.
- How to generate a text using GPT-4 and Mistral 7B.
- How to use a chat conversation with memory of the context.
- How to ingest data into a vector database, and use it.
You need to set the following environment variables:
AZURE_OPENAI_ENDPOINT
: your Azure OpenAI URL endpoint.AZURE_OPENAI_KEY
: your Azure OpenAI API key.
You can use a local version of Mistral 7B, and you need to set following environment variables:
MISTRAL_AI_BASE_URL
: your MistralAI URL endpoint (for examplehttp://localhost:1234/v1/
when running locally).MISTRAL_AI_KEY
: your MistralAI API key (which you would not use when running the model locally, so you can usefoo
as a value).
You need to set the following environment variables:
AZURE_SEARCH_ENDPOINT
: your Azure AI Search URL endpoint.AZURE_SEARCH_KEY
: your Azure AI Search API key.
You can run the demos using the following command:
./mvnw spring-boot:run
Then you can access the base URL, where you find the Web UI:
http://localhost:8080/