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

An Agentic application with Azure integrations on the LangChain.js framework.

License

NotificationsYou must be signed in to change notification settings

Azure-Samples/azure-typescript-langchainjs

This sample demonstrates how to build an intelligent agent using TypeScript,LangChain.js,LangGraph, Azure OpenAI, and Azure AI Search to create a Retrieval Augmented Generation (RAG) application.

The sample includes an HR document query system that allows users to ask questions about employee benefits and company policies, with the agent retrieving relevant information from PDF documents.

Agent Workflow

Features

  • TypeScript-based LangChain.js implementation
  • LangGraph agent architecture for dynamic orchestration of AI components
  • Integration with Azure OpenAI for embeddings and completions
  • Vector search with Azure AI Search
  • FastAPI server for RESTful API access
  • Docker support for containerized deployment
  • Environment variable management
  • PDF document processing and vector storage

Repository Structure

The repository is organized as a monorepo with the following packages:

  • langgraph-agent: Core agent implementation using LangGraph
  • server-api: FastAPI server exposing the agent functionality

Prerequisites

Getting Started

1. Clone the repository

git clone https://github.com/Azure-Samples/azure-typescript-langchainjs.gitcd azure-typescript-langchainjs

2. Set up Azure resources

Use Azure Developer CLI to deploy the resources.

azd auth loginazd up

This creates the resources ready to use with passwordless credentials.

3. Configure environment variables

The Azure Developer CLI creates a.env file with the necessary environment variables. Add the following optional variables to use LangSmith observability.

# Optional LangSmith configurationLANGSMITH_TRACING=trueLANGSMITH_ENDPOINT="https://api.smith.langchain.com"LANGSMITH_API_KEY="<your-langsmith-api-key>"LANGSMITH_PROJECT="<your-langsmith-project-name>"

4. Install dependencies

npm install

5. Load data into vector store

Build theserver-api andlanggraph-agent, then load the./packages/langgraph-agent/data into the vector store.

npm run buildnpm run load_data

6. Run the application

Run the API server

npm run start

The server will be available athttp://localhost:3000. In Visual Studio Code, you can use the Rest Client HTTP files at./packages/server-api/http to call the server APIs to use the agent.

API Usage

Use the following API to submit a question:

curl -X POST http://localhost:3000/answer \  -H"Content-Type: application/json" \  -d'{"question": "What are the standard benefit options?"}'

Example Questions

The agent can answer questions about the HR documents, such as:

  1. "What are the standard benefit options?"
  2. "Tell me about dental coverage in the Health Plus plan"
  3. "What does the employee handbook say about vacation time?"

Run the LangGraph Studio (optional)

npm run studio

This will start the LangGraph Studio interface where you can visualize and debug the agent's workflow.

LangGraph Studio

Docker Support

You can also run the application in a Docker container:

npm run build:dockernpm run start:docker

This will build a Docker image and run it, exposing the API server on port 3000.

License

This project is licensed under the ISC License - see theLICENSE.md file for details.

Contributing

Please readCONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

About

An Agentic application with Azure integrations on the LangChain.js framework.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp