- Notifications
You must be signed in to change notification settings - Fork4
An Agentic application with Azure integrations on the LangChain.js framework.
License
Azure-Samples/azure-typescript-langchainjs
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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.
- 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
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
- Node.js (v18 or later)
- npm
- Azure subscription
git clone https://github.com/Azure-Samples/azure-typescript-langchainjs.gitcd azure-typescript-langchainjsUse Azure Developer CLI to deploy the resources.
azd auth loginazd up
This creates the resources ready to use with passwordless credentials.
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>"npm install
Build theserver-api andlanggraph-agent, then load the./packages/langgraph-agent/data into the vector store.
npm run buildnpm run load_data
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.
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?"}'
The agent can answer questions about the HR documents, such as:
- "What are the standard benefit options?"
- "Tell me about dental coverage in the Health Plus plan"
- "What does the employee handbook say about vacation time?"
npm run studio
This will start the LangGraph Studio interface where you can visualize and debug the agent's workflow.
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.
This project is licensed under the ISC License - see theLICENSE.md file for details.
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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.

