Sure, here's the text translated into simplified Chinese while keeping the HTML structure: ```html

探索LangGraph以获取主动工作流

``` In this HTML snippet: - `

` denotes a paragraph tag. - `探索LangGraph以获取主动工作流` is the translated text meaning "Exploring LangGraph for Agentic Workflows" in simplified Chinese.

LanGraph for Agentic Workflows

Here is the translated text in simplified Chinese, keeping the HTML structure intact: ```html LangGraph 是一个开源库,旨在使用大语言模型(LLMs)构建有状态的多角色应用程序。它通过将这些工作流表示为图形来促进代理和多代理工作流的创建。这种方法似乎具有一些优势,包括循环和条件控制、可控性以及持久性,这些对于复杂的AI代理架构至关重要,有时也被称为代理体系结构。 ``` This translation maintains the original meaning while adapting it into simplified Chinese.

LangGraph 的特点

  1. Sure, here's the translated text in simplified Chinese while keeping the HTML structure intact: ```html Cycles and Branching — 允许在应用程序中实现循环和条件语句,使其与基于有向无环图(DAG)的解决方案有所区别。 ``` This translates to: ```html Cycles and Branching — 允许在应用程序中实现循环和条件语句,使其与基于有向无环图(DAG)的解决方案有所区别。 ```
  2. Sure, here's the translation of the text into simplified Chinese while preserving the HTML structure: ```html

    持久性 — 在图表的每一步后自动保存状态,使得可以暂停和恢复执行。这支持错误恢复、人机协作工作流程和时间旅行。

    ```
  3. Certainly! Here's the translation of the text into simplified Chinese, while keeping the HTML structure intact: ```html 人在回路中 — 将人类批准或干预整合到工作流程中,使得可以中断并修改代理人计划的动作。 ``` This HTML snippet preserves the structure while providing the translation of "Human-in-the-Loop" and the accompanying explanation in simplified Chinese.
  4. Sure, here is the translation in simplified Chinese while keeping the HTML structure: ```html Streaming Support — 将每个节点生成的输出流作为它们产生的输出,包括标记级别的流式处理。 ```
  5. Sure, here's the translation of the English text "Integration with LangChain — Seamlessly integrates with LangChain and LangSmith, though it can also function independently" into simplified Chinese while keeping the HTML structure: ```html

    与LangChain集成 — 与LangChain和LangSmith无缝集成,尽管它也可以独立运行。

    ```

Certainly! Here's how you could structure the HTML to display the translated text in simplified Chinese: ```html

Translate Text Example

Translate Text Example

这里是一个快速示例,展示LangGraph如何用于创建与搜索API交互的代理:

``` In this HTML structure: - `` specifies that the document is in English. - The `` tag ensures proper character encoding. - Inside the `` section, the `

` tag displays the heading "Translate Text Example". - The `

` tag contains the translated Chinese text: "这里是一个快速示例,展示LangGraph如何用于创建与搜索API交互的代理:" which translates to "Here is a quick example of how LangGraph can be used to create an agent that interacts with a search API:".

pip install -U langchain-community langchain_openai tavily-python
python
from langgraph.graph import END, StateGraph, MessagesState
from langgraph.prebuilt import ToolNode
from langchain_openai import ChatOpenAI
from langchain_community.tools.tavily_search import TavilySearchResults

# Define the tools for the agent to use
tools = [TavilySearchResults(max_results=1)]
tool_node = ToolNode(tools)
model = ChatOpenAI(temperature=0).bind_tools(tools)
# Function to determine the next step
def should_continue(state):
messages = state['messages']
last_message = messages[-1]
if last_message.tool_calls:
return "tools"
return END
# Function to call the model
def call_model(state):
messages = state['messages']
response = model.invoke(messages)
return {"messages": [response]}
# Define the workflow
workflow = StateGraph(MessagesState)
workflow.add_node("agent", call_model)
workflow.add_node("tools", tool_node)
workflow.set_entry_point("agent")
workflow.add_conditional_edges("agent", should_continue)
workflow.add_edge("tools", "agent")
# Initialize memory to persist state between graph runs
checkpointer = MemorySaver()
# Compile the workflow
app = workflow.compile(checkpointer=checkpointer)
# Invoke the graph with input
final_state = app.invoke({"messages": [{"content": "What is the weather in SF?"}]})
print(final_state["messages"][-1].content)

Sure, here's the translated text in simplified Chinese, keeping the HTML structure intact: ```html 这里是能够搜索网络并在交互中保持状态的上述代理。代理模型和工具已定义,并设置工作流以处理条件逻辑和持久状态。 ``` This HTML snippet retains the structure while presenting the translated text in simplified Chinese.

Sure, here is the translated text in simplified Chinese while keeping the HTML structure: ```html

参考资料:https://github.com/langchain-ai/langgraph, https://github.com/langchain-ai/langgraph-example, https://github.com/menloparklab/LangGraphJourney

```

2024-06-24 04:49:43 AI中文站翻译自原文