Appendix A — Libraries and frameworks used in the book
The tables identify packages, model IDs and connection interfaces used in the book. Entries marked Example give a concrete implementation where a chapter leaves that choice open. The reference architecture in Section 12.1 shows how the libraries work together.
The code examples use Python. The commands below identify the packages to install, not a tested set of pinned versions. PyPDFLoader and RecursiveCharacterTextSplitter are classes supplied by the listed packages, not separate packages.
| Python package, class or module | Installation and official source | Role in the examples |
|---|---|---|
openai: OpenAI |
pip install openai · Python SDK on GitHub |
Send model requests and read responses and usage. The API interface is selected separately. |
pydantic: BaseModel, Field |
pip install pydantic · Pydantic on GitHub |
Check returned fields against Python types and constraints. |
langchain-community: PyPDFLoader |
pip install langchain-community pypdf · LangChain community integrations |
Load PDF text with document and page metadata, using the pypdf backend. |
langchain-text-splitters: RecursiveCharacterTextSplitter |
pip install langchain-text-splitters · Recursive splitter documentation |
Divide page text into chunks using size and overlap settings in Section 6.7. |
langchain-huggingface: HuggingFaceEmbeddings; sentence-transformers |
pip install langchain-huggingface sentence-transformers · Embedding integration |
The LangChain class calls Sentence Transformers to load the embedding model and compute vectors. |
faiss-cpu: faiss; LangChain class FAISS |
pip install faiss-cpu langchain-community · FAISS on GitHub |
Search vectors through the LangChain wrapper. This command selects the CPU backend; GPU installation depends on the platform. |
rank-bm25: BM25Okapi (Example) |
pip install rank-bm25 · rank-bm25 on GitHub |
A Python implementation of the BM25 lexical scoring method discussed in Chapter 6, not imported by its listing. |
ragas |
pip install ragas · Ragas installation |
Compute configured RAG evaluation metrics. Model-assisted metrics also need a configured model client. |
langgraph: StateGraph |
pip install langgraph · LangGraph on GitHub |
Define workflow state and routing. Checkpoint storage is configured separately. |
fastmcp: FastMCP |
pip install fastmcp · FastMCP on GitHub |
The standalone Python framework used by the tool-server example. Its import is from fastmcp import FastMCP. |
An alternative JavaScript and TypeScript OpenAI SDK installs with npm install openai.
BGE is a family of embedding and reranking models. The IDs below locate model repositories. An exact saved version is selected with a pinned repository commit ID. A Python library loads and runs the model. Chapters 6 and 12 use the first model, while the reranker is an example implementation.
| Model repository ID | Model type and use | Python loader and source |
|---|---|---|
BAAI/bge-small-en-v1.5 |
Text embedding model weights used to turn queries and passages into vectors in Chapters 6 and 12. | HuggingFaceEmbeddings through sentence-transformers, installed in Table A.1. Model card. |
BAAI/bge-reranker-base (Example) |
A cross-encoder model that scores a query and a candidate passage together for reranking. | pip install FlagEmbedding; class FlagReranker. Model card and loader example. |
Chat Completions and Responses are APIs, not installable libraries. They use different request and response formats over HTTP. MCP is a protocol for exchanging tool, resource and prompt messages between a client and a server.
| API or protocol | Request and response | Client and official reference |
|---|---|---|
| OpenAI Chat Completions API | POST /v1/chat/completions; a messages list is sent, and the result contains choices with assistant messages. |
client.chat.completions.create(...) in the OpenAI SDK. Chat Completions reference. |
| OpenAI Responses API | POST /v1/responses; input produces output items such as messages and tool calls. This is a different API from Chat Completions. |
client.responses.create(...) in the same SDK. Responses migration guide. |
| Model Context Protocol (MCP) | JSON-RPC messages over local standard input/output (stdio) or Streamable HTTP. | The FastMCP framework in Table A.1 implements MCP. A separate official Python SDK is installed with pip install mcp. Protocol transports; Python SDK. |
The Nebius examples use the OpenAI Python SDK with a different base_url and the provider’s Chat Completions API. Nebius Token Factory’s API reference documents that connection. OpenAI compatibility alone does not establish support for the Responses API. The provider must document the endpoint and features it supports.
Chapter 13 describes experiment records and traces. The following entries identify tools for collecting them, plus a container runtime as an example implementation for code execution.
| Tool and type | Installation and official source | Role |
|---|---|---|
| Docker Engine / Docker Desktop (Example container runtime) | Install the runtime for the operating system, not a Python package. Docker installation. | Package a code runner in a container. Chapter 9 leaves the sandbox implementation to the application. |
MLflow (experiment tracking service and Python library) |
pip install mlflow · MLflow on GitHub |
Record runs with parameters, metrics and saved outputs. The tracking service can run locally or remotely. |
OpenTelemetry (standard and language SDKs) |
pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp · Python SDK |
Collect spans and send them to a configured Collector or compatible storage and analysis service. It is not itself that storage service. |
Langfuse (LLM tracing service and Python SDK) |
pip install langfuse · Python SDK |
Send linked generation, retrieval and tool observations to a configured Langfuse service. |
A default Docker container is not a complete sandbox for untrusted code. Its security documentation describes isolation limits and configuration requirements.