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-groq-tool-use")
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(model="llama3")
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.2.2.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

langchain_ollama-0.2.2-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file langchain_ollama-0.2.2.tar.gz.

File metadata

  • Download URL: langchain_ollama-0.2.2.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for langchain_ollama-0.2.2.tar.gz
Algorithm Hash digest
SHA256 2d9bcb06ffdbe43c7c6906c46e710d36d33b6b99cd4975cbf54060f13e51c875
MD5 4419be34e31746202f600c2cf78d6601
BLAKE2b-256 888e21f1df6af0983cf1bc6d15c71f21bd17d968114bf6cce0fb40442f5ba81f

See more details on using hashes here.

File details

Details for the file langchain_ollama-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_ollama-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a1ee72dbb6ea3b3ace1d9dd317e472d667a8ed491328550da59f4893a6796f8
MD5 24809bfb9abff4894cda0302057a88a9
BLAKE2b-256 7f77219fb2290c832e33af2731246ea3328bade50756288c1e97ae73c4ccc197

See more details on using hashes here.

Supported by

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