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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_ollama-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cc5f3d510e591cb66b382f4fe32801877593c0d0a1dc48e9e8fcd16b8e01c454
MD5 cc3127a2dd3374d280953fc7432e5684
BLAKE2b-256 df618bbf6fae7ed5b43eebbaf3bbdeaef960c547135b5d4332dc238aa6c95e98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_ollama-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e4017178b2fbf822c74b29eaca3732c925265a63d9dd9fe6970c34fd32568c4a
MD5 ca9c30d7b0bb669cfe7db424d81f0400
BLAKE2b-256 662d44085dd19b14272c845e555da81bfd5e2da6604acf2cba344ede50495dcb

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