Large Language Models (LLMs)
The LLM is responsible for reading text and generating natural language responses to queries. By default, LlamaIndex.TS uses gpt-4o.
The LLM can be explicitly updated through Settings.
Installation
Section titled “Installation”npm i llamaindex @llamaindex/openaiimport { OpenAI } from "@llamaindex/openai";import { Settings } from "llamaindex";
Settings.llm = new OpenAI({ model: "gpt-3.5-turbo", temperature: 0 });Azure OpenAI
Section titled “Azure OpenAI”To use Azure OpenAI, you only need to set a few environment variables.
For example:
export AZURE_OPENAI_KEY="<YOUR KEY HERE>"export AZURE_OPENAI_ENDPOINT="<YOUR ENDPOINT, see https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line%2Cpython&pivots=rest-api>"export AZURE_OPENAI_DEPLOYMENT="gpt-4" # or some other deployment nameLocal LLM
Section titled “Local LLM”For local LLMs, currently we recommend the use of Ollama LLM.
Available LLMs
Section titled “Available LLMs”Most available LLMs are listed in the sidebar on the left. Additionally the following integrations exist without separate documentation:
Check the LlamaIndexTS Github for the most up to date overview of integrations.
API Reference
Section titled “API Reference”Note for AI agents: this documentation is built for programmatic access.
- Overview of all docs: https://developers.llamaindex.ai/llms.txt
- Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md
- Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters.
- A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/python/shared/mcp/