Skip to main content

An integration package connecting Ollama and LangChain

Project description

langchain-ollama

This package contains the LangChain integration with Ollama

Installation

pip install -U langchain-ollama

You will also need to run the Ollama server locally. You can download it here.

Chat Models

ChatOllama class exposes chat models from Ollama.

from langchain_ollama import ChatOllama

llm = ChatOllama(model="llama3")
llm.invoke("Sing a ballad of LangChain.")

Embeddings

OllamaEmbeddings class exposes embeddings from Ollama.

from langchain_ollama import OllamaEmbeddings

embeddings = OllamaEmbeddings(model="llama3")
embeddings.embed_query("What is the meaning of life?")

LLMs

OllamaLLM class exposes LLMs from Ollama.

from langchain_ollama import OllamaLLM

llm = OllamaLLM()
llm.invoke("The meaning of life is")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_ollama-0.1.0rc0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

langchain_ollama-0.1.0rc0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file langchain_ollama-0.1.0rc0.tar.gz.

File metadata

  • Download URL: langchain_ollama-0.1.0rc0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.4 Darwin/23.5.0

File hashes

Hashes for langchain_ollama-0.1.0rc0.tar.gz
Algorithm Hash digest
SHA256 561eca1a88f8711189d8a901c3820e60251311afba7dd31ba3854b52f06a267b
MD5 3ae638f0928638e2eed3c86728d765cc
BLAKE2b-256 92f30e9254d2cca2b09f25b8ca0460903e7138932588545ec095d50d4277fda5

See more details on using hashes here.

File details

Details for the file langchain_ollama-0.1.0rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_ollama-0.1.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab82a4fc4db6641907c75645e1a6284b520c311c28503a7d2728d596c18b6897
MD5 27d166317818ddb514afbd636e570f81
BLAKE2b-256 909d7936f1898c3139f62536e9b7f0148974dcbe283220f150fa418004119665

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page