-
Notifications
You must be signed in to change notification settings - Fork 758
build(deps): upgrade to LangChain 1.x and resolve transitive NumPy 2.0+ conflicts #350
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,7 @@ dev = [ | |
| "mkdocs-macros-plugin", | ||
| "mkdocs-autorefs", | ||
| "prometheus-client", | ||
| "pandas-stubs", | ||
| ] | ||
| experiment = [ | ||
| "random-word", | ||
|
|
@@ -182,10 +183,11 @@ anthropic = [ | |
| "anthropic", | ||
| ] | ||
| langchain = [ | ||
| "langgraph<1.0", | ||
| "langchain[openai]<1.0", | ||
| "langgraph", | ||
| "langchain[openai]>=1.0.0", | ||
| "langchain-community", | ||
| "langchain-text-splitters<1.0", | ||
| "langchain-text-splitters", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please commit the new uv.lock |
||
| "langsmith", | ||
| ] | ||
| sql = [ | ||
| "sqlparse", | ||
|
|
@@ -230,6 +232,14 @@ conflicts = [ | |
| { group = "torch-stable" }, | ||
| { group = "torch-legacy" }, | ||
| ], | ||
| [ | ||
| {group = "torch-gpu-legacy"}, | ||
| {group = "langchain"}, | ||
| ], | ||
| [ | ||
| {group = "torch-legacy"}, | ||
| {group = "langchain"}, | ||
| ] | ||
| ] | ||
| environments = [ | ||
| "sys_platform == 'linux'", | ||
|
|
@@ -257,6 +267,7 @@ torch = [ | |
| { index = "pytorch-cpu", group = "torch-cpu" }, | ||
| ] | ||
| tinker_cookbook = { git = "https://github.com/thinking-machines-lab/tinker-cookbook" } | ||
| verl = {git = "https://github.com/Acture/verl.git"} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is ireelevant |
||
|
|
||
| [[tool.uv.index]] | ||
| name = "pypi" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,9 +50,9 @@ | |
| from autogen_ext.models.openai import OpenAIChatCompletionClient | ||
| from autogen_ext.tools.mcp import McpWorkbench, StdioServerParams | ||
| from fastapi import FastAPI | ||
| from langchain import hub | ||
| from langchain.agents import AgentExecutor, create_react_agent, tool | ||
| from langchain.agents import create_agent | ||
| from langchain.chat_models import init_chat_model | ||
| from langchain.tools import tool | ||
| from langchain_community.agent_toolkits import SQLDatabaseToolkit | ||
| from langchain_community.utilities import SQLDatabase | ||
| from langchain_core.messages import AIMessage, BaseMessage, HumanMessage, ToolMessage | ||
|
|
@@ -61,6 +61,7 @@ | |
| from langchain_openai import ChatOpenAI | ||
| from langgraph.graph import END, START, MessagesState, StateGraph | ||
| from langgraph.prebuilt import ToolNode | ||
| from langsmith import Client as LangsmithClient | ||
| from openai import AsyncOpenAI, OpenAI | ||
| from opentelemetry.sdk.trace import ReadableSpan | ||
| from pydantic import BaseModel, Field | ||
|
|
@@ -86,7 +87,6 @@ | |
| REAL_OPENAI_BASE_URL is not None and REAL_OPENAI_API_KEY is not None | ||
| ), "OPENAI_BASE_URL and OPENAI_API_KEY must be set when USE_OPENAI is true" | ||
|
|
||
|
|
||
| _langchain_callback_handler = None | ||
|
|
||
|
|
||
|
|
@@ -133,7 +133,7 @@ def normalize_messages(msgs: List[Dict[str, Any]]) -> str: | |
| # Flatten messages to a string for comparison | ||
| if not msgs: | ||
| return "" | ||
| return "\n".join(f"{m.get('role','')}:{m.get('content','')}" for m in msgs) | ||
| return "\n".join(f"{m.get('role', '')}:{m.get('content', '')}" for m in msgs) | ||
|
|
||
| req_msgs = request_dict.get("messages", []) | ||
| req_tools = request_dict.get("tools", "") | ||
|
|
@@ -301,12 +301,14 @@ def multiply(a_and_b: str) -> int: | |
| disable_streaming=True, | ||
| ) | ||
| tools = [multiply] | ||
| agent = create_react_agent(llm, tools, hub.pull("hwchase17/react")) | ||
| agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=False) | ||
| result = agent_executor.invoke( | ||
| {"input": "what is 42 * 12"}, | ||
| {"callbacks": [_langchain_callback_handler]} if _langchain_callback_handler else None, | ||
| hub = LangsmithClient() | ||
| prompt_tmp: PromptTemplate = hub.pull_prompt("hwchase17/react") | ||
|
|
||
| prompt = prompt_tmp.format_prompt( | ||
| tools=[multiply.description], tool_names=multiply.name, input="what is 42 * 12", agent_scratchpad="" | ||
| ) | ||
| agent = create_agent(llm, tools) | ||
| result = agent.invoke(input=prompt) | ||
| assert "504" in result["output"] | ||
|
|
||
|
|
||
|
|
@@ -526,7 +528,6 @@ async def openai_agents_sdk_mcp_tool_use() -> None: | |
|
|
||
|
|
||
| async def openai_agents_sdk_handoff_tool_output_type_and_reward() -> None: | ||
|
|
||
| class MathOutput(BaseModel): | ||
| answer: int | ||
|
|
||
|
|
@@ -918,4 +919,4 @@ def _debug_with_agentops(): | |
| if __name__ == "__main__": | ||
| # run_with_agentops_tracer() | ||
| run_with_http_tracer() | ||
| # _debug_with_agentops() | ||
| # _debug_with_agentops() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is irrelevant
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is altered by pre-commit.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is altered by pre-commit.