Files
langchaingo/examples/ollama-documents-loader
Dmitry Ng 064f09155c chore(deps): bump Go toolchain to 1.26.5 and fix vulnerable dependencies
- Raised the `go` directive from 1.24.1 to 1.26.5 to satisfy pgx/v5 and ollama's minimum Go version requirements and to pick up 15 patched standard library CVEs.
- Updated `pgx/v5`, `otel`/`otel/sdk`/`otlptracehttp`, `x/net`, and the AWS `eventstream` protocol package to their latest requested versions.
- Remediated govulncheck-flagged CVEs in `grpc`, `x/text`, `x/crypto`, `antchfx/xpath`, AWS SDK `bedrock*`/`s3` services, `etcd/server`, and `mongo-driver` v1/v2.
- Fixed ollama's `MainGPU` API type change (`int` -> `*int`) in `llms/ollama/options.go` without breaking the public `WithRunnerMainGPU` signature.
2026-08-04 13:57:26 +03:00
..
2024-07-11 11:25:01 +02:00
2024-07-11 11:25:01 +02:00

Example with Document Loader and Ollama

Prerequisite

This example uses Ollama as the LLM engine. So, you should install it. You can find all informations here.

Example of an installation with Docker :

docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

And after, you can load a model :

docker exec ollama ollama run tinydolphin

Example explanations

This example present the integration of Langchain with Ollama while showcasing the use of a PDF document to enrich the context.

Actually, the PDF of the example contains 1 page and contains information from Langchain documentation.

Steps of the example :

  1. Load documents (for the context) from the PDF file
  2. Initialize the llm and the chain
  3. Prompt the model with context loads from the PDF

The prompt targets a question where the answer is contained in the context.