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

Uploaded Source

Built Distribution

langchain_ollama-0.1.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_ollama-0.1.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for langchain_ollama-0.1.1.tar.gz
Algorithm Hash digest
SHA256 91b3b6cfcc90890c683995520d84210ebd2cee8c0f2cd0a5ffde9f1ffbee2f94
MD5 09fc8ee1905d354d44784eb8ca521550
BLAKE2b-256 2fe18b3318d44eb3d997d097ceef7b7d955eb626933adb45f3267098286724a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_ollama-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 179b6f21e01fc72ebc034ec725f8c5dcef4a81709919278e6fa4f43605df5d82
MD5 8546b8a7df1c06bfba3d041d1b932e99
BLAKE2b-256 865f8c2934abdfd860fec2b286dc0773df07815c7aed3ea90302c69508edc192

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