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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_ollama-0.2.0.dev1.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.dev1.tar.gz
Algorithm Hash digest
SHA256 3eb4df14afcd99027db5f2631be7b55f04242224639d3454c1bfcf10f75f17c2
MD5 4f6d6be0d00aabf20021971c776658ce
BLAKE2b-256 6f26851ddd7e75882cc62c439e42889ef8359dcccbb8fe64653c729824caae75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_ollama-0.2.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 3748ff74970de39cd698555600ca53649649cb51b2d33c52985bb35bbbb7c442
MD5 0efbd965388571f8a7a095d4a6a098ff
BLAKE2b-256 e6a6d6a1af06fb634fbd9886160d03007c54158f64a21bbfa94bbbd9869e66d8

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