langchain/docs
rylativity dbf9986d44
langchain-ollama (partners) / langchain-core: allow passing ChatMessages to Ollama (including arbitrary roles) (#30411)
Replacement for PR #30191 (@ccurme)

**Description**: currently, ChatOllama [will raise a value error if a
ChatMessage is passed to
it](https://github.com/langchain-ai/langchain/blob/master/libs/partners/ollama/langchain_ollama/chat_models.py#L514),
as described
https://github.com/langchain-ai/langchain/pull/30147#issuecomment-2708932481.

Furthermore, ollama-python is removing the limitations on valid roles
that can be passed through chat messages to a model in ollama -
https://github.com/ollama/ollama-python/pull/462#event-16917810634.

This PR removes the role limitations imposed by langchain and enables
passing langchain ChatMessages with arbitrary 'role' values through the
langchain ChatOllama class to the underlying ollama-python Client.

As this PR relies on [merged but unreleased functionality in
ollama-python](
https://github.com/ollama/ollama-python/pull/462#event-16917810634), I
have temporarily pointed the ollama package source to the main branch of
the ollama-python github repo.

Format, lint, and tests of new functionality passing. Need to resolve
issue with recently added ChatOllama tests. (Now resolved)

**Issue**: resolves #30122 (related to ollama issue
https://github.com/ollama/ollama/issues/8955)

**Dependencies**: no new dependencies

[x] PR title
[x] PR message
[x] Lint and test: format, lint, and test all running successfully and
passing

---------

Co-authored-by: Ryan Stewart <ryanstewart@Ryans-MacBook-Pro.local>
Co-authored-by: Chester Curme <chester.curme@gmail.com>
2025-04-18 10:07:07 -04:00
..
api_reference docs: enforce newlines when signature exceeds char threshold (#30866) 2025-04-16 08:45:40 -04:00
cassettes docs: update SQL QA prompt (#30728) 2025-04-08 09:42:49 -04:00
data docs: 👥 Update LangChain people data (#27022) 2024-10-08 17:09:07 +00:00
docs langchain-ollama (partners) / langchain-core: allow passing ChatMessages to Ollama (including arbitrary roles) (#30411) 2025-04-18 10:07:07 -04:00
scripts docs: Add openGauss vector store documentation (#30742) 2025-04-11 20:31:39 +00:00
src docs: Add openGauss vector store documentation (#30742) 2025-04-11 20:31:39 +00:00
static docs: fix llms-txt (#30528) 2025-03-27 19:02:44 +00:00
.gitignore infra: cleanup docs build (#21134) 2024-05-01 17:34:05 -07:00
.yarnrc.yml docs[minor]: Add thumbs up/down to all docs pages (#18526) 2024-03-04 15:14:28 -08:00
babel.config.js
docusaurus.config.js Banner for interrupt (#29567) 2025-02-03 17:40:24 -08:00
ignore-step.sh infra: run docs build on packages.yml updates (#29796) 2025-02-19 18:45:30 +00:00
Makefile docs: fix httpx conflicts with overrides in docs build (#29180) 2025-01-13 21:25:00 +00:00
package.json docs: raw loader codeblock (#28548) 2024-12-06 09:26:34 -08:00
README.md docs: reorganize contributing docs (#27649) 2024-10-25 22:41:54 +00:00
sidebars.js docs: reorg sidebar (#27978) 2024-11-15 14:28:18 -08:00
vercel_overrides.txt docs: add to vercel overrides (#30063) 2025-03-01 17:21:15 -05:00
vercel_requirements.txt docs: more useful vercel warnings (#28699) 2024-12-13 03:07:24 +00:00
vercel.json docs: tests/standard tests api ref redirect (#29444) 2025-01-27 23:21:50 -08:00
yarn.lock docs: raw loader codeblock (#28548) 2024-12-06 09:26:34 -08:00

LangChain Documentation

For more information on contributing to our documentation, see the Documentation Contributing Guide