Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This sample shows how to quickly get started with LlamaIndex.ai on Azure 🚀

License

NotificationsYou must be signed in to change notification settings

Azure-Samples/llama-index-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open project in GitHub CodespacesBuild StatusNode versionLicense

This sample shows how to quickly get started withLlamaIndex for TypeScript on Azure. The application is hosted onAzure Container Apps. You can use it as a starting point for building more complex RAG applications.

(Like and fork this sample to receive lastest changes and updates)

FeaturesArchitecture DiagramGetting StartedGuidanceResourcesTroubleshootingContributingTrademarksLicenseGive us a star

Screenshot showing the LlamaIndex app in action

Features

This 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.

Architecture Diagram

Screenshot showing the chatgpt app high level diagram

This application is built around a single component:

  • A full-stack Next.js application that is hosted onAzure Container Apps in just a few commands. This app usesLlamaIndex.TS, a TypeScript library that can ingest any PDF, text, CSV, Markdown, Word and HTML files.

  • The app usesAzure OpenAI to answer questions about the data you provide. The app is set up to use thegpt-35-turbo model and embeddings to provide the best and fastest answers to your questions.

Getting Started

You have a few options for getting started with this template. The quickest way to get started isGitHub Codespaces, since it will setup all the tools for you, but you can alsoset it up locally. You can also use aVS Code dev container

This template usesgpt-35-turbo version1106 which may not be available in all Azure regions. Check forup-to-date region availability and select a region during deployment accordingly

  • We recommend usingswedencentral

GitHub Codespaces

You can run this template virtually by using GitHub Codespaces. The button will open a web-based VS Code instance in your browser:

  1. Open the template (this may take several minutes)Open in GitHub Codespaces

  2. Open a terminal window

  3. Sign into your Azure account:

     azd auth login
  4. Provision the Azure resources and deploy your code:

     azd up
  5. Install the app dependencies:

     npm install

VS Code Dev Containers

A related option is VS Code Dev Containers, which will open the project in your local VS Code using theDev Containers extension:

  1. Start Docker Desktop (install it if not already installed)

  2. Open the project:Open in Dev Containers

  3. In the VS Code window that opens, once the project files show up (this may take several minutes), open a terminal window.

  4. Sign into your Azure account:

     azd auth login
  5. Provision the Azure resources and deploy your code:

     azd up
  6. Install the app dependencies:

     npm install
  7. Configure a CI/CD pipeline:

    azd pipeline config

To start the web app, run the following command:

npm run dev

Open the URLhttp://localhost:3000 in your browser to interact with the bot.

Local Environment

Prerequisites

You need to install following tools to work on your local machine:

  • Docker
  • Node.js LTS
  • Azure Developer CLI
  • Git
  • PowerShell 7+(for Windows users only)
    • Important: Ensure you can runpwsh.exe from a PowerShell command. If this fails, you likely need to upgrade PowerShell.
    • Instead of Powershell, you can also use Git Bash or WSL to run the Azure Developer CLI commands.
  • This template usesgpt-35-turbo version1106 which may not be available in all Azure regions. Check forup-to-date region availability and select a region during deployment accordingly
    • We recommend usingswedencentral

Then you can get the project code:

  1. Fork the project to create your own copy of this repository.
  2. On your forked repository, select theCode button, then theLocal tab, and copy the URL of your forked repository.
  3. Open a terminal and run this command to clone the repo: git clone <your-repo-url>

Quickstart (with Azure OpenAI models)

  1. Bring down the template code:

    azd init --template llama-index-javascript

    This will perform a git clone

  2. Sign into your Azure account:

     azd auth login
  3. Install all dependencies:

     npm install
  4. Provision and deploy the project to Azure:

    azd up
  5. Configure a CI/CD pipeline:

    azd pipeline config

Once 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.

Local Development

To run the sample, run the following commands, which will start the Next.js app.

  1. Open a terminal and navigate to the root of the project, then run app:

     npm run dev

Open the URLhttp://localhost:3000 in your browser to interact with the Assistant.

Guidance

Region Availability

This template usesgpt-35-turbo version1106 which may not be available in all Azure regions. Check forup-to-date region availability and select a region during deployment accordingly

  • We recommend usingswedencentral

Costs

Pricing varies per region and usage, so it isn't possible to predict exact costs for your usage.However, you can use theAzure pricing calculator for the resources below to get an estimate.

  • Azure Container Apps: Consumption plan, Free for the first 2M executions. Pricing per execution and memory used.Pricing
  • Azure OpenAI: Standard tier, GPT and Ada models. Pricing per 1K tokens used, and at least 1K tokens are used per question.Pricing

Warning

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 runningazd down --purge.

Security

Note

When implementing this template please specify whether the template uses Managed Identity or Key Vault

This template has eitherManaged Identity 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 aGitHub Action tool 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 theGithub secret scanning setting is enabled in your repos.

Resources

Here are some resources to learn more about the technologies used in this sample:

You can also findmore Azure AI samples here.

Troubleshooting

If you can't find a solution to your problem, pleaseopen an issue in this repository.

Contributing

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

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

This project has adopted theMicrosoft Open Source Code of Conduct.For more information see theCode of Conduct FAQ orcontactopencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsofttrademarks or logos is subject to and must followMicrosoft'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.

About

This sample shows how to quickly get started with LlamaIndex.ai on Azure 🚀

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp