Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Deprecate create_cohere_tools_agent and connectors #113

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions libs/cohere/langchain_cohere/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)

from cohere.types import NonStreamedChatResponse, ToolCall
from langchain_core._api.deprecation import warn_deprecated
from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLLMRun,
Expand Down Expand Up @@ -229,6 +230,15 @@ def get_cohere_chat_request(
Returns:
The request for the Cohere chat API.
"""
if connectors or "connectors" in kwargs:
warn_deprecated(
since="0.3.3",
message=(
"The 'connectors' parameter is deprecated as of version 0.3.3.\n"
"Please use the 'tools' parameter instead."
),
removal="0.4.0",
)
additional_kwargs = messages[-1].additional_kwargs

# cohere SDK will fail loudly if both connectors and documents are provided
Expand Down
2 changes: 1 addition & 1 deletion libs/cohere/langchain_cohere/cohere_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

@deprecated(
since="0.1.7",
removal="",
removal="0.4.0",
alternative="""Use the 'tool calling agent'
or 'Langgraph agent' with the ChatCohere class instead.
See https://docs.cohere.com/docs/cohere-and-langchain for more information.""",
Expand Down
5 changes: 4 additions & 1 deletion libs/cohere/langchain_cohere/rag_retrievers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def _get_docs(response: Any) -> List[Document]:
class CohereRagRetriever(BaseRetriever):
"""Cohere Chat API with RAG."""

connectors: List[Dict] = Field(default_factory=lambda: [{"id": "web-search"}])
connectors: List[Dict] = Field(
default_factory=lambda: [{"id": "web-search"}],
deprecated="The 'connectors' parameter is deprecated as of version 0.3.3. Please use the 'tools' parameter instead.", # noqa: E501
)
"""
When specified, the model's reply will be enriched with information found by
querying each of the connectors (RAG). These will be returned as langchain
Expand Down
2 changes: 1 addition & 1 deletion libs/cohere/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langchain-cohere"
version = "0.3.2"
version = "0.3.3"
description = "An integration package connecting Cohere and LangChain"
authors = []
readme = "README.md"
Expand Down