Giter Site home page Giter Site logo

azure-samples / azure-openai-rag-workshop Goto Github PK

View Code? Open in Web Editor NEW
66.0 5.0 170.0 22.62 MB

Create your own ChatGPT with Retrieval-Augmented-Generation workshop

Home Page: https://aka.ms/ws/openai-rag

License: MIT License

Bicep 17.46% Shell 4.29% HTML 1.60% TypeScript 61.37% Dockerfile 8.82% JavaScript 0.08% PowerShell 0.91% Java 5.48%
azure chatgpt fastify langchain nodejs openai rag workshop

azure-openai-rag-workshop's Introduction

๐Ÿค– azure-openai-rag-workshop

In this workshop, we will build a chatbot based on OpenAI language models and implementing the Retrieval Augmented Generation (RAG) pattern.

This workshop exists in different variants:

Node.js

You'll use Fastify to create a Node.js service that leverage OpenAI SDK and LangChain to build a chatbot that will answer questions based on a corpus of documents, as well as a website to test it.

Java

You'll use Quarkus to create a Java service that leverage OpenAI SDK and LangChain4j to build a chatbot that will answer questions based on a corpus of documents, as well as a website to test it.

Prerequisites

  • Azure account. If you're new to Azure, get an Azure account for free to get free Azure credits to get started.
  • Azure subscription with access enabled for the Azure OpenAI service. You can request access with this form.

You can use GitHub Codespaces to work on this project directly from your browser: select the Code button, then the Codespaces tab and click on Create Codespaces on main.

You can also use Docker and the Dev Containers extension for VS Code to work locally using a ready-to-use dev environment.

Project details

This project is structured as monorepo, all packages source code is located under the src/ folder.

Here's the architecture of the application:

Architecture diagram

How deploy to Azure

Before deploying to Azure, you need to install the Azure Developer CLI. Once you're ready, run the following commands:

azd auth login
azd up

This commands will first ask you to log in into Azure. Then it will provison the Azure resources, package the services and deploy them to Azure.

References

This workshop is based on the enterprise-ready sample ChatGPT + Enterprise data with Azure OpenAI and AI Search:

If you want to go further with more advanced use-cases, authentication, history and more, you should check it out!

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

azure-openai-rag-workshop's People

Contributors

agoncal avatar cmaneu avatar ikhemissi avatar jdubois avatar sandraahlgrimm avatar sinedied avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

azure-openai-rag-workshop's Issues

Shall we rename the Indexer component ?

At first I didn't understand what "Indexer" meant in the document processor. And the documentation mentions "Data ingestion". So what about renaming the component "Indexer" to something else:

  • data-ingestion
  • data-ingestor
  • ingestor (does it exist in Engligh or is it ingester)

azd deploy frontend cant deploy

Hi thank you for the amazing workshop.
Whenever I'm trying to deploy the workshop i'm getting this error in azd deploy for frontend. Backend can be deployed without any issue. Can you please help on this. Thank you.

azd deploy

Deploying services (azd deploy)

  (โœ“) Done: Deploying service backend
  - Endpoint: https://backend.prouddune-953d9eb4.japaneast.azurecontainerapps.io/

  |===    | Deploying service frontend (Copying deployment package)Export-ModuleMember: C:\Users\Ahmed\AppData\Local\Temp\azd-predeploy-1559059345.ps1:4
Line |
   4 |  Export-ModuleMember -Variable BACKEND_API_URI && npm run build
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The Export-ModuleMember cmdlet can only be called from inside a module.
  (x) Failed: Deploying service frontend

ERROR: failed deploying service 'frontend': failed invoking event handlers for 'predeploy', 'predeploy' hook failed with exit code: '1', Path: 'C:\Users\Ahmed\AppData\Local\Temp\azd-predeploy-1559059345.ps1'. : exit code: 1

Promise.withResolvers is not a function

Getting stuck in the ingestion step with the following error:

@jimmyland22 โžœ /workspaces/azure-openai-rag-workshop (main) $ ./scripts/ingest-data.sh
Loading azd .env file from current environment
Installing dependencies and building CLI

up to date, audited 699 packages in 2s

155 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

[email protected] build
tsc

Running "ingest-files" CLI tool
Ingesting 3 file(s)...
Ingesting file "./data/privacy-policy.pdf"...
Error ingesting files: Error ingesting file "./data/privacy-policy.pdf": Unknown server error: Promise.withResolvers is not a function

Create an Ingestion service in Java

Today the Indexer is written in Typescript (azure-openai-rag-workshop/src/indexer). We need to create the same functionality but in Java using LangChain4j

Insufficient quota

The steps of provsions are confusing in my opinion and even after going through multiple times and hours of research, couldn't make it work. Lots of Time Lost !

InsufficientQuota: This operation require 30 new capacity in quota Tokens Per Minute (thousands) - GPT-35-Turbo, which is bigger than the current available capacity 0. The current quota usage is 1 and the quota limit is 1 for quota Tokens Per Minute (thousands) - GPT-35-Turbo

Container Apps errors

After running the command "azd provision," the backend container app as well as the indexer container app revision goes from Provisioning - Activating - Degraded. The backend container logs have a message about Qdrant URL needs to be set. The indexer container logs has messages stating the connection was refused.

You cannot move forward in the workshop steps. When you run the "./scripts/index-data.sh" the CLI output says it is indexing 3 files(s) but after a few minutes, the command times out.

Steps to reproduce:
Follow the workshop instructions on step 5 and wait for the resources to be deployed. Then check the replicas in both Container Apps.

Not showing NODE_ENV in the Dockerfile

In the Create the Dockerfile section, you show the following file:

FROM node:18-alpine as build
WORKDIR /app
COPY ./package*.json ./
COPY ./src/backend ./src/backend
RUN npm ci --cache /tmp/empty-cache
RUN npm run build --workspace=backend

And then you write:

The second statement ENV NODE_ENV=production sets the NODE_ENV environment variable to production. This is a convention in the Node.js ecosystem to indicate that the app is running in production mode. It enables production optimizations in most frameworks.

The NODE_ENV is not shown in this Dockerfil. You do find it after, but not at this moment.

Azure CLI commands to deploy the app don't work

The following Azure CLI commands listed in the steps don't work, when I try to deploy the app:
azd auth login
azd up

Could you update the steps to deploy this Web App using the Azure CLI + Azure DevOps extensions?

src/plugins/chat.ts(9,27): error TS2304: Cannot find name 'SearchClient'.

[builder] > [email protected] build
[builder] > tsc
[builder]
[builder] src/plugins/chat.ts(9,27): error TS2304: Cannot find name 'SearchClient'.
[builder] src/plugins/chat.ts(18,35): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.
[builder] src/plugins/chat.ts(31,25): error TS2554: Expected 7 arguments, but got 0.
[builder] Timer: Builder ran for 1m8.8381461s and ended at 2024-01-29T23:47:44Z
[builder] ERROR: failed to build: exit status 1
, stderr: [builder] npm WARN deprecated @bufbuild/[email protected]: Connect has moved to its own org @connectrpc and has a stable v1. Run npx @connectrpc/connect-migrate@latest to update. See https://github.com/connectrpc/connect-es/releases/tag/v0.13.1 for details.
[builder] npm WARN deprecated @bufbuild/[email protected]: Connect has moved to its own org @connectrpc and has a stable v1. Run npx @connectrpc/connect-migrate@latest to update. See https://github.com/connectrpc/connect-es/releases/tag/v0.13.1 for details.
[builder] npm notice
[builder] npm notice New minor version of npm available! 10.2.3 -> 10.4.0
[builder] npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.4.0
[builder] npm notice Run npm install -g [email protected] to update!
[builder] npm notice
ERROR: failed to build: executing lifecycle: failed with status code: 51

Getting an error message when running azd up in the src/plugins/chat.ts file.

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.