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.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

langchain_ollama-0.2.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_ollama-0.2.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for langchain_ollama-0.2.0.tar.gz
Algorithm Hash digest
SHA256 250ad9f3edce1a0ca16e4fad19f783ac728d7d76888ba952c462cd9f680353f7
MD5 73e8295d903ac3024ce97307a5df70d7
BLAKE2b-256 811bc05811f5a0bb0c57a4aadd01eaadbfff8cb0d1225a22e4a79d9185b984a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_ollama-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa5b794599652494a07fd27b22784854480cd4c793f0db5e81ebeccc2affd135
MD5 6495cd130766f10efa422592a7c904c5
BLAKE2b-256 ba158192d91f2b27bab26b9fd008a1212b44f4848d07d311777ab6ec0ae7b49a

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