{"id":19099786,"url":"https://github.com/Azure-Samples/llama-index-javascript","last_synced_at":"2025-04-18T17:32:02.294Z","repository":{"id":243213986,"uuid":"811754358","full_name":"Azure-Samples/llama-index-javascript","owner":"Azure-Samples","description":"This sample shows how to quickly get started with LlamaIndex.ai on Azure 🚀","archived":false,"fork":false,"pushed_at":"2024-09-09T15:17:19.000Z","size":3707,"stargazers_count":16,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-10T11:54:39.619Z","etag":null,"topics":["ai-azd-templates","azd-templates","azure","azure-openai","docker","llama-index","llm","nextjs","openai"],"latest_commit_sha":null,"homepage":"","language":"Bicep","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Azure-Samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-07T08:29:13.000Z","updated_at":"2024-09-09T15:17:23.000Z","dependencies_parsed_at":"2024-06-12T19:45:33.639Z","dependency_job_id":"473ad157-dc42-485c-a4b4-19156a3d8021","html_url":"https://github.com/Azure-Samples/llama-index-javascript","commit_stats":null,"previous_names":["manekinekko/llama-index-nextjs-aca","azure-samples/llama-index-javascript"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure-Samples%2Fllama-index-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure-Samples%2Fllama-index-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure-Samples%2Fllama-index-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azure-Samples%2Fllama-index-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Azure-Samples","download_url":"https://codeload.github.com/Azure-Samples/llama-index-javascript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223783108,"owners_count":17201903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-azd-templates","azd-templates","azure","azure-openai","docker","llama-index","llm","nextjs","openai"],"created_at":"2024-11-09T03:52:17.275Z","updated_at":"2025-04-18T17:32:02.287Z","avatar_url":"https://github.com/Azure-Samples.png","language":"Bicep","funding_links":[],"categories":["azure","docker"],"sub_categories":[],"readme":"\u003c!--\n---\nname: Serverless Azure OpenAI Quick Start with LlamaIndex (JavaScript)\ndescription: Build a simple RAG app with LlamaIndex and Azure OpenAI, deployed on Azure Container Apps\nlanguages:\n- javascript\n- typescript\n- nodejs\n- bicep\n- azdeveloper\nproducts:\n- azure-openai\n- azure-container-apps\n- azure\npage_type: sample\nurlFragment: llama-index-javascript\n---\n--\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# Serverless Azure OpenAI Quick Start with LlamaIndex \u003cbr\u003e (JavaScript)\n\n[![Open project in GitHub Codespaces](https://img.shields.io/badge/Codespaces-Open-blue?style=flat-square\u0026logo=github)](https://codespaces.new/Azure-Samples/llama-index-javascript?hide_repo_select=true\u0026ref=main\u0026quickstart=true)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/Azure-Samples/llama-index-javascript/build-test.yaml?style=flat-square\u0026label=Build)](https://github.com/Azure-Samples/llama-index-javascript/actions)\n![Node version](https://img.shields.io/badge/Node.js-\u003e=20-3c873a?style=flat-square)\n[![License](https://img.shields.io/badge/License-MIT-pink?style=flat-square)](LICENSE)\n\nThis sample shows how to quickly get started with [LlamaIndex for TypeScript](https://ts.llamaindex.ai/) on Azure. The application is hosted on [Azure Container Apps](https://learn.microsoft.com/azure/container-apps/). You can use it as a starting point for building more complex RAG applications.\n\n(Like and fork this sample to receive lastest changes and updates)\n\n[![Features](https://img.shields.io/badge/🚀%20Features-blue?style=flat-square)](#features)\n[![Architecture Diagram](https://img.shields.io/badge/🏗️%20Architecture%20Diagram-blue?style=flat-square)](#architecture-diagram)\n[![Getting Started](https://img.shields.io/badge/🚦%20Getting%20Started-blue?style=flat-square)](#getting-started)\n[![Guidance](https://img.shields.io/badge/📚%20Guidance-blue?style=flat-square)](#guidance)\n[![Resources](https://img.shields.io/badge/📚%20Resources-blue?style=flat-square)](#resources)\n[![Troubleshooting](https://img.shields.io/badge/🛠️%20Troubleshooting-blue?style=flat-square)](#troubleshooting)\n[![Contributing](https://img.shields.io/badge/🤝%20Contributing-blue?style=flat-square)](#contributing)\n[![Trademarks](https://img.shields.io/badge/™%20Trademarks-blue?style=flat-square)](#trademarks)\n[![License](https://img.shields.io/badge/📜%20License-blue?style=flat-square)](LICENSE)\n[![Give us a star](https://img.shields.io/badge/⭐%20Give%20us%20a%20star-blue?style=flat-square)](https://github.com/Azure-Samples/llama-index-javascript/stargazers)\n\n  \u003cimg src=\"./docs/llama-index-javascript.png\" alt=\"Screenshot showing the LlamaIndex app in action\" width=\"640px\" /\u003e\n\n\u003c/div\u003e\n\n## Features\n\nThis project demonstrates how to build a simple LlamaIndex application using Azure OpenAI. The app is set up as a chat interface that can answer questions about your data. You can add arbitrary data sources to your chat, like local files, websites, or data retrieved from a database. The app will ingest any supported files you put in `./data/` directory. This sample app uses LlamaIndex.TS that is able to ingest any PDF, text, CSV, Markdown, Word and HTML files.\n\n## Architecture Diagram\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./docs/architecture-diagram-llama-index-javascript.png\" alt=\"Screenshot showing the chatgpt app high level diagram\" width=\"640px\" /\u003e\n\u003c/div\u003e\n\nThis application is built around a single component:\n\n- A full-stack Next.js application that is hosted on [Azure Container Apps](https://learn.microsoft.com/azure/container-apps/) in just a few commands. This app uses [LlamaIndex.TS](https://github.com/run-llama/LlamaIndexTS), a TypeScript library that can ingest any PDF, text, CSV, Markdown, Word and HTML files.\n\n- The app uses [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview) to answer questions about the data you provide. The app is set up to use the `gpt-35-turbo` model and embeddings to provide the best and fastest answers to your questions.\n\n## Getting Started\n\nYou have a few options for getting started with this template. The quickest way to get started is [GitHub Codespaces](#github-codespaces), since it will setup all the tools for you, but you can also [set it up locally](#local-environment). You can also use a [VS Code dev container](#vs-code-dev-containers)\n\nThis template uses `gpt-35-turbo` version `1106`  which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly\n\n  * We recommend using `swedencentral`\n\n### GitHub Codespaces\n\nYou can run this template virtually by using GitHub Codespaces. The button will open a web-based VS Code instance in your browser:\n\n1. Open the template (this may take several minutes)\n    [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/Azure-Samples/llama-index-javascript?hide_repo_select=true\u0026ref\u0026quickstart=true)\n2. Open a terminal window\n3. Sign into your Azure account:\n\n    ```shell\n     azd auth login\n    ```\n4. Provision the Azure resources and deploy your code:\n\n    ```shell\n     azd up\n    ```\n5. Install the app dependencies:\n\n    ```bash\n     npm install\n    ```\n\n### VS Code Dev Containers\n\nA related option is VS Code Dev Containers, which will open the project in your local VS Code using the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers):\n\n1. Start Docker Desktop (install it if not already installed)\n2. Open the project:\n    [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge\u0026label=Dev%20Containers\u0026message=Open\u0026color=blue\u0026logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/Azure-Samples/llama-index-javascript)\n3. In the VS Code window that opens, once the project files show up (this may take several minutes), open a terminal window.\n4. Sign into your Azure account:\n\n    ```shell\n     azd auth login\n    ```\n5. Provision the Azure resources and deploy your code:\n\n    ```shell\n     azd up\n    ```\n6. Install the app dependencies:\n\n    ```bash\n     npm install\n    ```\n7. Configure a CI/CD pipeline:\n\n    ```shell\n    azd pipeline config\n    ```\n\nTo start the web app, run the following command:\n\n```bash\nnpm run dev\n```\n\nOpen the URL `http://localhost:3000` in your browser to interact with the bot.\n\n### Local Environment\n\n#### Prerequisites\n\nYou need to install following tools to work on your local machine:\n\n- [Docker](https://docs.docker.com/get-docker)\n- [Node.js LTS](https://nodejs.org/download/)\n- [Azure Developer CLI](https://aka.ms/azure-dev/install)\n- [Git](https://git-scm.com/downloads)\n- [PowerShell 7+](https://github.com/powershell/powershell) _(for Windows users only)_\n  - **Important**: Ensure you can run `pwsh.exe` from a PowerShell command. If this fails, you likely need to upgrade PowerShell.\n  - Instead of Powershell, you can also use Git Bash or WSL to run the Azure Developer CLI commands.\n- This template uses `gpt-35-turbo` version `1106` which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly\n  * We recommend using `swedencentral`\n\nThen you can get the project code:\n\n1. [**Fork**](https://github.com/Azure-Samples/llama-index-javascript/fork) the project to create your own copy of this repository.\n2. On your forked repository, select the **Code** button, then the **Local** tab, and copy the URL of your forked repository.\n3. Open a terminal and run this command to clone the repo: \u003ccode\u003e git clone \u0026lt;your-repo-url\u0026gt; \u003c/code\u003e\n\n#### Quickstart (with Azure OpenAI models)\n\n1. Bring down the template code:\n\n    ```shell\n    azd init --template llama-index-javascript\n    ```\n\n    This will perform a git clone\n\n2. Sign into your Azure account:\n\n    ```shell\n     azd auth login\n    ```\n\n3. Install all dependencies:\n\n    ```bash\n     npm install\n    ```\n4. Provision and deploy the project to Azure:\n\n    ```shell\n    azd up\n    ```\n4. Configure a CI/CD pipeline:\n\n    ```shell\n    azd pipeline config\n    ```\n\nOnce your deployment is complete, you should see a `.env` file at the root of the project. This file contains the environment variables needed to run the application using Azure resources.\n\n#### Local Development\n\nTo run the sample, run the following commands, which will start the Next.js app.\n\n1. Open a terminal and navigate to the root of the project, then run app:\n\n    ```bash\n     npm run dev\n\nOpen the URL `http://localhost:3000` in your browser to interact with the Assistant.\n\n## Guidance\n\n### Region Availability\n\nThis template uses `gpt-35-turbo` version `1106` which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly\n  * We recommend using `swedencentral`\n\n### Costs\n\nPricing varies per region and usage, so it isn't possible to predict exact costs for your usage.\nHowever, you can use the [Azure pricing calculator](https://azure.com/e/bf51ef20b57a4da08e47511938ad5415) for the resources below to get an estimate.\n\n- Azure Container Apps: Consumption plan, Free for the first 2M executions. Pricing per execution and memory used. [Pricing](https://azure.microsoft.com/en-us/pricing/details/container-apps/)\n- Azure OpenAI: Standard tier, GPT and Ada models. Pricing per 1K tokens used, and at least 1K tokens are used per question. [Pricing](https://azure.microsoft.com/pricing/details/cognitive-services/openai-service/)\n\n\u003e [!WARNING]\n\u003e To avoid unnecessary costs, remember to take down your app if it's no longer in use, either by deleting the resource group in the Portal or running `azd down --purge`.\n\n### Security\n\n\u003e [!NOTE]\n\u003e When implementing this template please specify whether the template uses Managed Identity or Key Vault\n\nThis template has either [Managed Identity](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/overview) or Key Vault built in to eliminate the need for developers to manage these credentials. Applications can use managed identities to obtain Microsoft Entra tokens without having to manage any credentials. Additionally, we have added a [GitHub Action tool](https://github.com/microsoft/security-devops-action) that scans the infrastructure-as-code files and generates a report containing any detected issues. To ensure best practices in your repo we recommend anyone creating solutions based on our templates ensure that the [Github secret scanning](https://docs.github.com/code-security/secret-scanning/about-secret-scanning) setting is enabled in your repos.\n\n\n## Resources\n\nHere are some resources to learn more about the technologies used in this sample:\n\n- [LlamaIndexTS Documentation](https://ts.llamaindex.ai) - learn about LlamaIndex (Typescript features).\n- [Generative AI For Beginners](https://github.com/microsoft/generative-ai-for-beginners)\n- [Azure OpenAI Service](https://learn.microsoft.com/azure/ai-services/openai/overview)\n- [Azure OpenAI Assistant Builder](https://github.com/Azure-Samples/azure-openai-assistant-builder)\n- [Chat + Enterprise data with Azure OpenAI and Azure AI Search](https://github.com/Azure-Samples/azure-search-openai-javascript)\n\nYou can also find [more Azure AI samples here](https://github.com/Azure-Samples/azureai-samples).\n\n## Troubleshooting\n\nIf you can't find a solution to your problem, please [open an issue](https://github.com/Azure-Samples/llama-index-javascript/issues) in this repository.\n\n## Contributing\n\nThis project welcomes contributions and suggestions. Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n## Trademarks\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft\ntrademarks or logos is subject to and must follow\n[Microsoft's Trademark \u0026 Brand Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks/usage/general).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.\nAny use of third-party trademarks or logos are subject to those third-party's policies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzure-Samples%2Fllama-index-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAzure-Samples%2Fllama-index-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAzure-Samples%2Fllama-index-javascript/lists"}