id
stringlengths
14
16
text
stringlengths
31
2.73k
source
stringlengths
56
166
cb658ba15ae5-0
Source code for langchain.agents.loading """Functionality for loading agents.""" import json from pathlib import Path from typing import Any, List, Optional, Union import yaml from langchain.agents.agent import BaseSingleActionAgent from langchain.agents.agent_types import AgentType from langchain.agents.chat.base impo...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/loading.html
cb658ba15ae5-1
) -> BaseSingleActionAgent: config_type = config.pop("_type") if config_type not in AGENT_TO_CLASS: raise ValueError(f"Loading {config_type} agent not supported") if config_type not in AGENT_TO_CLASS: raise ValueError(f"Loading {config_type} agent not supported") agent_cls = AGENT_TO_CLA...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/loading.html
cb658ba15ae5-2
if "llm_chain" in config: config["llm_chain"] = load_chain_from_config(config.pop("llm_chain")) elif "llm_chain_path" in config: config["llm_chain"] = load_chain(config.pop("llm_chain_path")) else: raise ValueError("One of `llm_chain` and `llm_chain_path` should be specified.") combi...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/loading.html
cb658ba15ae5-3
return load_agent_from_config(config, **kwargs) By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Apr 18, 2023.
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/loading.html
220a2e419e74-0
Source code for langchain.agents.initialize """Load agent.""" from typing import Any, Optional, Sequence from langchain.agents.agent import AgentExecutor from langchain.agents.agent_types import AgentType from langchain.agents.loading import AGENT_TO_CLASS, load_agent from langchain.callbacks.base import BaseCallbackMa...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/initialize.html
220a2e419e74-1
"but at most only one should be." ) if agent is not None: if agent not in AGENT_TO_CLASS: raise ValueError( f"Got unknown agent type: {agent}. " f"Valid types are: {AGENT_TO_CLASS.keys()}." ) agent_cls = AGENT_TO_CLASS[agent] ag...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/initialize.html
bac13fbb3425-0
Source code for langchain.agents.agent_types from enum import Enum [docs]class AgentType(str, Enum): ZERO_SHOT_REACT_DESCRIPTION = "zero-shot-react-description" REACT_DOCSTORE = "react-docstore" SELF_ASK_WITH_SEARCH = "self-ask-with-search" CONVERSATIONAL_REACT_DESCRIPTION = "conversational-react-descri...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_types.html
c745f204e074-0
Source code for langchain.agents.tools """Interface for tools.""" from inspect import signature from typing import Any, Awaitable, Callable, Optional, Union from langchain.tools.base import BaseTool [docs]class Tool(BaseTool): """Tool that takes in function or coroutine directly.""" description: str = "" fu...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/tools.html
c745f204e074-1
return f"{tool_name} is not a valid tool, try another one." [docs]def tool(*args: Union[str, Callable], return_direct: bool = False) -> Callable: """Make tools out of functions, can be used with or without arguments. Requires: - Function must be of type (str) -> str - Function must have a docstr...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/tools.html
c745f204e074-2
elif len(args) == 1 and callable(args[0]): # if the argument is a function, then we use the function name as the tool name # Example usage: @tool return _make_with_name(args[0].__name__)(args[0]) elif len(args) == 0: # if there are no arguments, then we use the function name as the t...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/tools.html
fd265ceb60a1-0
Source code for langchain.agents.react.base """Chain that implements the ReAct paper from https://arxiv.org/pdf/2210.03629.pdf.""" import re from typing import Any, List, Optional, Sequence, Tuple from langchain.agents.agent import Agent, AgentExecutor from langchain.agents.agent_types import AgentType from langchain.a...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/react/base.html
fd265ceb60a1-1
return text + "\nAction:" def _extract_tool_and_input(self, text: str) -> Optional[Tuple[str, str]]: action_prefix = "Action: " if not text.strip().split("\n")[-1].startswith(action_prefix): return None action_block = text.strip().split("\n")[-1] action_str = action_block...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/react/base.html
fd265ceb60a1-2
"""Search for a term in the docstore, and if found save.""" result = self.docstore.search(term) if isinstance(result, Document): self.document = result return self._summary else: self.document = None return result def lookup(self, term: str) ->...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/react/base.html
fd265ceb60a1-3
"""Return default prompt.""" return TEXTWORLD_PROMPT @classmethod def _validate_tools(cls, tools: Sequence[BaseTool]) -> None: if len(tools) != 1: raise ValueError(f"Exactly one tool must be specified, but got {tools}") tool_names = {tool.name for tool in tools} if to...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/react/base.html
ae5fd683be19-0
Source code for langchain.agents.self_ask_with_search.base """Chain that does self ask with search.""" from typing import Any, Optional, Sequence, Tuple, Union from langchain.agents.agent import Agent, AgentExecutor from langchain.agents.agent_types import AgentType from langchain.agents.self_ask_with_search.prompt imp...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/self_ask_with_search/base.html
ae5fd683be19-1
if followup not in last_line: finish_string = "So the final answer is: " if finish_string not in last_line: return None return "Final Answer", last_line[len(finish_string) :] after_colon = text.split(":")[-1] if " " == after_colon[0]: after...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/self_ask_with_search/base.html
ae5fd683be19-2
search_tool = Tool( name="Intermediate Answer", func=search_chain.run, description="Search" ) agent = SelfAskWithSearchAgent.from_llm_and_tools(llm, [search_tool]) super().__init__(agent=agent, tools=[search_tool], **kwargs) By Harrison Chase © Copyright 2023, Harrison Cha...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/self_ask_with_search/base.html
25089bc177d0-0
Source code for langchain.agents.conversational.base """An agent designed to hold a conversation in addition to using tools.""" from __future__ import annotations import re from typing import Any, List, Optional, Sequence, Tuple from langchain.agents.agent import Agent from langchain.agents.agent_types import AgentType...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/conversational/base.html
25089bc177d0-1
"""Create prompt in the style of the zero shot agent. Args: tools: List of tools the agent will have access to, used to format the prompt. prefix: String to put before the list of tools. suffix: String to put after the list of tools. ai_prefix: Str...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/conversational/base.html
25089bc177d0-2
match = re.search(regex, llm_output) if not match: raise ValueError(f"Could not parse LLM output: `{llm_output}`") action = match.group(1) action_input = match.group(2) return action.strip(), action_input.strip(" ").strip('"') [docs] @classmethod def from_llm_and_tools...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/conversational/base.html
fcff29dc735f-0
Source code for langchain.agents.agent_toolkits.csv.base """Agent for working with csvs.""" from typing import Any, Optional from langchain.agents.agent import AgentExecutor from langchain.agents.agent_toolkits.pandas.base import create_pandas_dataframe_agent from langchain.llms.base import BaseLLM [docs]def create_csv...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/csv/base.html
fe228885c6a9-0
Source code for langchain.agents.agent_toolkits.vectorstore.base """VectorStore agent.""" from typing import Any, Optional from langchain.agents.agent import AgentExecutor from langchain.agents.agent_toolkits.vectorstore.prompt import PREFIX, ROUTER_PREFIX from langchain.agents.agent_toolkits.vectorstore.toolkit import...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/vectorstore/base.html
fe228885c6a9-1
prefix: str = ROUTER_PREFIX, verbose: bool = False, **kwargs: Any, ) -> AgentExecutor: """Construct a vectorstore router agent from an LLM and tools.""" tools = toolkit.get_tools() prompt = ZeroShotAgent.create_prompt(tools, prefix=prefix) llm_chain = LLMChain( llm=llm, prompt=pr...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/vectorstore/base.html
9e373f461f2d-0
Source code for langchain.agents.agent_toolkits.json.base """Json agent.""" from typing import Any, List, Optional from langchain.agents.agent import AgentExecutor from langchain.agents.agent_toolkits.json.prompt import JSON_PREFIX, JSON_SUFFIX from langchain.agents.agent_toolkits.json.toolkit import JsonToolkit from l...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/json/base.html
9e373f461f2d-1
) By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Apr 18, 2023.
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/json/base.html
a3bf6d4ba558-0
Source code for langchain.agents.agent_toolkits.openapi.base """OpenAPI spec agent.""" from typing import Any, List, Optional from langchain.agents.agent import AgentExecutor from langchain.agents.agent_toolkits.openapi.prompt import ( OPENAPI_PREFIX, OPENAPI_SUFFIX, ) from langchain.agents.agent_toolkits.opena...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/openapi/base.html
a3bf6d4ba558-1
prompt=prompt, callback_manager=callback_manager, ) tool_names = [tool.name for tool in tools] agent = ZeroShotAgent(llm_chain=llm_chain, allowed_tools=tool_names, **kwargs) return AgentExecutor.from_agent_and_tools( agent=agent, tools=toolkit.get_tools(), verbose=verbose...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/openapi/base.html
44809b44d5df-0
Source code for langchain.agents.agent_toolkits.sql.base """SQL agent.""" from typing import Any, List, Optional from langchain.agents.agent import AgentExecutor from langchain.agents.agent_toolkits.sql.prompt import SQL_PREFIX, SQL_SUFFIX from langchain.agents.agent_toolkits.sql.toolkit import SQLDatabaseToolkit from ...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/sql/base.html
44809b44d5df-1
prompt=prompt, callback_manager=callback_manager, ) tool_names = [tool.name for tool in tools] agent = ZeroShotAgent(llm_chain=llm_chain, allowed_tools=tool_names, **kwargs) return AgentExecutor.from_agent_and_tools( agent=agent, tools=tools, verbose=verbose, max_...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/sql/base.html
1c66e299621b-0
Source code for langchain.agents.agent_toolkits.pandas.base """Agent for working with pandas objects.""" from typing import Any, List, Optional from langchain.agents.agent import AgentExecutor from langchain.agents.agent_toolkits.pandas.prompt import PREFIX, SUFFIX from langchain.agents.mrkl.base import ZeroShotAgent f...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/pandas/base.html
1c66e299621b-1
llm_chain = LLMChain( llm=llm, prompt=partial_prompt, callback_manager=callback_manager, ) tool_names = [tool.name for tool in tools] agent = ZeroShotAgent(llm_chain=llm_chain, allowed_tools=tool_names, **kwargs) return AgentExecutor.from_agent_and_tools( agent=agent, ...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/agent_toolkits/pandas/base.html
903aaf058574-0
Source code for langchain.agents.conversational_chat.base """An agent designed to hold a conversation in addition to using tools.""" from __future__ import annotations import json from typing import Any, List, Optional, Sequence, Tuple from langchain.agents.agent import Agent from langchain.agents.conversational_chat.p...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/conversational_chat/base.html
903aaf058574-1
cleaned_output = cleaned_output.strip() response = json.loads(cleaned_output) return {"action": response["action"], "action_input": response["action_input"]} [docs]class ConversationalChatAgent(Agent): """An agent designed to hold a conversation in addition to using tools.""" output_parser: Base...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/conversational_chat/base.html
903aaf058574-2
MessagesPlaceholder(variable_name="chat_history"), HumanMessagePromptTemplate.from_template(final_prompt), MessagesPlaceholder(variable_name="agent_scratchpad"), ] return ChatPromptTemplate(input_variables=input_variables, messages=messages) def _extract_tool_and_input(self, ...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/conversational_chat/base.html
903aaf058574-3
prompt = cls.create_prompt( tools, system_message=system_message, human_message=human_message, input_variables=input_variables, output_parser=_output_parser, ) llm_chain = LLMChain( llm=llm, prompt=prompt, ca...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/conversational_chat/base.html
5a15a01fafa4-0
Source code for langchain.agents.mrkl.base """Attempt to implement MRKL systems as described in arxiv.org/pdf/2205.00445.pdf.""" from __future__ import annotations import re from typing import Any, Callable, List, NamedTuple, Optional, Sequence, Tuple from langchain.agents.agent import Agent, AgentExecutor from langcha...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/mrkl/base.html
5a15a01fafa4-1
# \s matches against tab/newline/whitespace regex = r"Action: (.*?)[\n]*Action Input:[\s]*(.*)" match = re.search(regex, llm_output, re.DOTALL) if not match: raise ValueError(f"Could not parse LLM output: `{llm_output}`") action = match.group(1).strip() action_input = match.group(2) retu...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/mrkl/base.html
5a15a01fafa4-2
input_variables: List of input variables the final prompt will expect. Returns: A PromptTemplate with the template assembled from the pieces here. """ tool_strings = "\n".join([f"{tool.name}: {tool.description}" for tool in tools]) tool_names = ", ".join([tool.name for tool i...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/mrkl/base.html
5a15a01fafa4-3
@classmethod def _validate_tools(cls, tools: Sequence[BaseTool]) -> None: for tool in tools: if tool.description is None: raise ValueError( f"Got a tool {tool.name} without a description. For this agent, " f"a description must always be pro...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/mrkl/base.html
5a15a01fafa4-4
from langchain.chains.mrkl.base import ChainConfig llm = OpenAI(temperature=0) search = SerpAPIWrapper() llm_math_chain = LLMMathChain(llm=llm) chains = [ ChainConfig( action_name = "Search", ...
https://langchain-cn.readthedocs.io/en/latest/_modules/langchain/agents/mrkl/base.html
75a649497bfc-0
.md .pdf Jina Contents Installation and Setup Wrappers Embeddings Jina# This page covers how to use the Jina ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Jina wrappers. Installation and Setup# Install the Python SDK with pip install jina Get a Jina A...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/jina.html
e6bd362eb2fd-0
.md .pdf Runhouse Contents Installation and Setup Self-hosted LLMs Self-hosted Embeddings Runhouse# This page covers how to use the Runhouse ecosystem within LangChain. It is broken into three parts: installation and setup, LLMs, and Embeddings. Installation and Setup# Install the Python SDK with pip install runhouse...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/runhouse.html
7cfc541d4cdd-0
.ipynb .pdf Comet Contents Install Comet and Dependencies Initialize Comet and Set your Credentials Set OpenAI and SerpAPI credentials Scenario 1: Using just an LLM Scenario 2: Using an LLM in a Chain Scenario 3: Using An Agent with Tools Scenario 4: Using Custom Evaluation Metrics Comet# In this guide we will demons...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/comet_tracking.html
7cfc541d4cdd-1
print("LLM result", llm_result) comet_callback.flush_tracker(llm, finish=True) Scenario 2: Using an LLM in a Chain# from langchain.callbacks import CometCallbackHandler, StdOutCallbackHandler from langchain.callbacks.base import CallbackManager from langchain.chains import LLMChain from langchain.llms import OpenAI fro...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/comet_tracking.html
7cfc541d4cdd-2
) manager = CallbackManager([StdOutCallbackHandler(), comet_callback]) llm = OpenAI(temperature=0.9, callback_manager=manager, verbose=True) tools = load_tools(["serpapi", "llm-math"], llm=llm, callback_manager=manager) agent = initialize_agent( tools, llm, agent="zero-shot-react-description", callback_...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/comet_tracking.html
7cfc541d4cdd-3
"reference": self.reference, } reference = """ The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building. It was the first structure to reach a height of 300 metres. It is now taller than the Chrysler Building in New York City by 5.2 metres (17 ft) Excluding transmitters, the Eiffe...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/comet_tracking.html
7cfc541d4cdd-4
a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller t...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/comet_tracking.html
413d3985411c-0
.md .pdf OpenSearch Contents Installation and Setup Wrappers VectorStore OpenSearch# This page covers how to use the OpenSearch ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific OpenSearch wrappers. Installation and Setup# Install the Python package with ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/opensearch.html
16d515200f1e-0
.md .pdf Replicate Contents Installation and Setup Calling a model Replicate# This page covers how to run models on Replicate within LangChain. Installation and Setup# Create a Replicate account. Get your API key and set it as an environment variable (REPLICATE_API_TOKEN) Install the Replicate python client with pip ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/replicate.html
16d515200f1e-1
prompt = """ Answer the following yes/no question by reasoning step by step. Can a dog drive a car? """ llm(prompt) We can call any Replicate model (not just LLMs) using this syntax. For example, we can call Stable Diffusion: text2image = Replicate(model="stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6d...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/replicate.html
9a32479656d5-0
.md .pdf StochasticAI Contents Installation and Setup Wrappers LLM StochasticAI# This page covers how to use the StochasticAI ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific StochasticAI wrappers. Installation and Setup# Install with pip install stochas...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/stochasticai.html
1a68b6969219-0
.md .pdf ForefrontAI Contents Installation and Setup Wrappers LLM ForefrontAI# This page covers how to use the ForefrontAI ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific ForefrontAI wrappers. Installation and Setup# Get an ForefrontAI api key and set i...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/forefrontai.html
959b7b42738a-0
.md .pdf Databerry Contents What is Databerry? Quick start Databerry# This page covers how to use the Databerry within LangChain. What is Databerry?# Databerry is an open source document retrievial platform that helps to connect your personal data with Large Language Models. Quick start# Retrieving documents stored i...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/databerry.html
a0df2b001041-0
.md .pdf PGVector Contents Installation Setup Wrappers VectorStore Usage PGVector# This page covers how to use the Postgres PGVector ecosystem within LangChain It is broken into two parts: installation and setup, and then references to specific PGVector wrappers. Installation# Install the Python package with pip inst...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/pgvector.html
005bd99bd987-0
.md .pdf Zilliz Contents Installation and Setup Wrappers VectorStore Zilliz# This page covers how to use the Zilliz Cloud ecosystem within LangChain. Zilliz uses the Milvus integration. It is broken into two parts: installation and setup, and then references to specific Milvus wrappers. Installation and Setup# Instal...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/zilliz.html
fccb0df00974-0
.md .pdf RWKV-4 Contents Installation and Setup Usage RWKV Model File Rwkv-4 models -> recommended VRAM RWKV-4# This page covers how to use the RWKV-4 wrapper within LangChain. It is broken into two parts: installation and setup, and then usage with an example. Installation and Setup# Install the Python package with ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/rwkv.html
fccb0df00974-1
RWKV VRAM Model | 8bit | bf16/fp16 | fp32 14B | 16GB | 28GB | >50GB 7B | 8GB | 14GB | 28GB 3B | 2.8GB| 6GB | 12GB 1b5 | 1.3GB| 3GB | 6GB See the rwkv pip page for more information about strategies, including streaming and cuda support. previous Runhouse next SearxNG Search API Contents...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/rwkv.html
87a8b027fd8c-0
.md .pdf SearxNG Search API Contents Installation and Setup Self Hosted Instance: Wrappers Utility Tool SearxNG Search API# This page covers how to use the SearxNG search API within LangChain. It is broken into two parts: installation and setup, and then references to the specific SearxNG API wrapper. Installation an...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/searx.html
87a8b027fd8c-1
s.run("what is a large language model?") Tool# You can also load this wrapper as a Tool (to use with an Agent). You can do this with: from langchain.agents import load_tools tools = load_tools(["searx-search"], searx_host="http://localhost:8888", engines=["github"]) Note that we ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/searx.html
51fbf4d91d19-0
.md .pdf AtlasDB Contents Installation and Setup Wrappers VectorStore AtlasDB# This page covers how to use Nomic’s Atlas ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Atlas wrappers. Installation and Setup# Install the Python package with pip install ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/atlas.html
6f9be6b6f126-0
.md .pdf Wolfram Alpha Wrapper Contents Installation and Setup Wrappers Utility Tool Wolfram Alpha Wrapper# This page covers how to use the Wolfram Alpha API within LangChain. It is broken into two parts: installation and setup, and then references to specific Wolfram Alpha wrappers. Installation and Setup# Install r...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/wolfram_alpha.html
b7b8977e67f3-0
.md .pdf Google Search Wrapper Contents Installation and Setup Wrappers Utility Tool Google Search Wrapper# This page covers how to use the Google Search API within LangChain. It is broken into two parts: installation and setup, and then references to the specific Google Search wrapper. Installation and Setup# Instal...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/google_search.html
758c1e59c73f-0
.md .pdf CerebriumAI Contents Installation and Setup Wrappers LLM CerebriumAI# This page covers how to use the CerebriumAI ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific CerebriumAI wrappers. Installation and Setup# Install with pip install cerebrium G...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/cerebriumai.html
7490c13c368e-0
.md .pdf Hugging Face Contents Installation and Setup Wrappers LLM Embeddings Tokenizer Datasets Hugging Face# This page covers how to use the Hugging Face ecosystem (including the Hugging Face Hub) within LangChain. It is broken into two parts: installation and setup, and then references to specific Hugging Face wra...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/huggingface.html
7490c13c368e-1
from langchain.embeddings import HuggingFaceHubEmbeddings For a more detailed walkthrough of this, see this notebook Tokenizer# There are several places you can use tokenizers available through the transformers package. By default, it is used to count tokens for all LLMs. You can also use it to count tokens when splitt...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/huggingface.html
46ccb5fecae3-0
.md .pdf Google Serper Wrapper Contents Setup Wrappers Utility Output Tool Google Serper Wrapper# This page covers how to use the Serper Google Search API within LangChain. Serper is a low-cost Google Search API that can be used to add answer box, knowledge graph, and organic results data from Google Search. It is br...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/google_serper.html
46ccb5fecae3-1
Yes. Follow up: Who is the reigning men's U.S. Open champion? Intermediate answer: Current champions Carlos Alcaraz, 2022 men's singles champion. Follow up: Where is Carlos Alcaraz from? Intermediate answer: El Palmar, Spain So the final answer is: El Palmar, Spain > Finished chain. 'El Palmar, Spain' For a more detail...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/google_serper.html
0b2f648b0f65-0
.ipynb .pdf Aim Aim# Aim makes it super easy to visualize and debug LangChain executions. Aim tracks inputs and outputs of LLMs and tools, as well as actions of agents. With Aim, you can easily debug and examine an individual execution: Additionally, you have the option to compare multiple executions side by side: Aim ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/aim_tracking.html
0b2f648b0f65-1
aim_callback = AimCallbackHandler( repo=".", experiment_name="scenario 1: OpenAI LLM", ) manager = CallbackManager([StdOutCallbackHandler(), aim_callback]) llm = OpenAI(temperature=0, callback_manager=manager, verbose=True) The flush_tracker function is used to record LangChain assets on Aim. By default, the se...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/aim_tracking.html
0b2f648b0f65-2
] synopsis_chain.apply(test_prompts) aim_callback.flush_tracker( langchain_asset=synopsis_chain, experiment_name="scenario 3: Agent with Tools" ) Scenario 3 The third scenario involves an agent with tools. from langchain.agents import initialize_agent, load_tools from langchain.agents import AgentType # scenario 3 ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/aim_tracking.html
0b2f648b0f65-3
Thought: I now know the final answer Final Answer: Camila Morrone is Leo DiCaprio's girlfriend and her current age raised to the 0.43 power is 3.991298452658078. > Finished chain. previous AI21 Labs next Apify By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Apr 18, 2023.
https://langchain-cn.readthedocs.io/en/latest/ecosystem/aim_tracking.html
a22d5a056b2c-0
.md .pdf Hazy Research Contents Installation and Setup Wrappers LLM Hazy Research# This page covers how to use the Hazy Research ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Hazy Research wrappers. Installation and Setup# To use the manifest, install...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/hazy_research.html
ce8a5d87f76c-0
.md .pdf Banana Contents Installation and Setup Define your Banana Template Build the Banana app Wrappers LLM Banana# This page covers how to use the Banana ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Banana wrappers. Installation and Setup# Install...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/bananadev.html
ce8a5d87f76c-1
) result = tokenizer.decode(output[0], skip_special_tokens=True) # Return the results as a dictionary result = {'output': result} return result You can find a full example of a Banana app here. Wrappers# LLM# There exists an Banana LLM wrapper, which you can access with from langchain.llms import Banana...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/bananadev.html
c21b2972326e-0
.md .pdf Pinecone Contents Installation and Setup Wrappers VectorStore Pinecone# This page covers how to use the Pinecone ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Pinecone wrappers. Installation and Setup# Install the Python SDK with pip install ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/pinecone.html
9d57dbd9bf81-0
.md .pdf Weaviate Contents Installation and Setup Wrappers VectorStore Weaviate# This page covers how to use the Weaviate ecosystem within LangChain. What is Weaviate? Weaviate in a nutshell: Weaviate is an open-source ​database of the type ​vector search engine. Weaviate allows you to store JSON documents in a class...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/weaviate.html
9d57dbd9bf81-1
To import this vectorstore: from langchain.vectorstores import Weaviate For a more detailed walkthrough of the Weaviate wrapper, see this notebook previous Weights & Biases next Wolfram Alpha Wrapper Contents Installation and Setup Wrappers VectorStore By Harrison Chase © Copyright 2023, Harrison Chase. ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/weaviate.html
9853a9ef8b1a-0
.md .pdf Modal Contents Installation and Setup Define your Modal Functions and Webhooks Wrappers LLM Modal# This page covers how to use the Modal ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Modal wrappers. Installation and Setup# Install with pip in...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/modal.html
9853a9ef8b1a-1
@stub.webhook(method="POST") def get_text(item: Item): return {"prompt": run_gpt2.call(item.prompt)} Wrappers# LLM# There exists an Modal LLM wrapper, which you can access with from langchain.llms import Modal previous Milvus next NLPCloud Contents Installation and Setup Define your Modal Functions and Webhooks...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/modal.html
cc645cabfb5d-0
.md .pdf Writer Contents Installation and Setup Wrappers LLM Writer# This page covers how to use the Writer ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Writer wrappers. Installation and Setup# Get an Writer api key and set it as an environment varia...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/writer.html
a0083c5fe832-0
.md .pdf Cohere Contents Installation and Setup Wrappers LLM Embeddings Cohere# This page covers how to use the Cohere ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Cohere wrappers. Installation and Setup# Install the Python SDK with pip install coher...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/cohere.html
ea766e149253-0
.md .pdf Qdrant Contents Installation and Setup Wrappers VectorStore Qdrant# This page covers how to use the Qdrant ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Qdrant wrappers. Installation and Setup# Install the Python SDK with pip install qdrant-c...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/qdrant.html
74aa9bbb2e47-0
.md .pdf Petals Contents Installation and Setup Wrappers LLM Petals# This page covers how to use the Petals ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Petals wrappers. Installation and Setup# Install with pip install petals Get a Hugging Face api k...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/petals.html
f7037acc2caa-0
.md .pdf Helicone Contents What is Helicone? Quick start How to enable Helicone caching How to use Helicone custom properties Helicone# This page covers how to use the Helicone ecosystem within LangChain. What is Helicone?# Helicone is an open source observability platform that proxies your OpenAI traffic and provide...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/helicone.html
f7037acc2caa-1
Quick start How to enable Helicone caching How to use Helicone custom properties By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Apr 18, 2023.
https://langchain-cn.readthedocs.io/en/latest/ecosystem/helicone.html
293511a6e466-0
.md .pdf Milvus Contents Installation and Setup Wrappers VectorStore Milvus# This page covers how to use the Milvus ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Milvus wrappers. Installation and Setup# Install the Python SDK with pip install pymilvus...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/milvus.html
37f8e48c93e4-0
.md .pdf Unstructured Contents Installation and Setup Wrappers Data Loaders Unstructured# This page covers how to use the unstructured ecosystem within LangChain. The unstructured package from Unstructured.IO extracts clean text from raw source documents like PDFs and Word documents. This page is broken into two part...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/unstructured.html
37f8e48c93e4-1
loader = UnstructuredFileLoader("state_of_the_union.txt") loader.load() If you instantiate the loader with UnstructuredFileLoader(mode="elements"), the loader will track additional metadata like the page number and text type (i.e. title, narrative text) when that information is available. previous StochasticAI next Wei...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/unstructured.html
cc4a360fb36b-0
.md .pdf Chroma Contents Installation and Setup Wrappers VectorStore Chroma# This page covers how to use the Chroma ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Chroma wrappers. Installation and Setup# Install the Python package with pip install chro...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/chroma.html
91ad4bdcacd9-0
.md .pdf SerpAPI Contents Installation and Setup Wrappers Utility Tool SerpAPI# This page covers how to use the SerpAPI search APIs within LangChain. It is broken into two parts: installation and setup, and then references to the specific SerpAPI wrapper. Installation and Setup# Install requirements with pip install ...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/serpapi.html
e554f2dba1c9-0
.md .pdf Llama.cpp Contents Installation and Setup Wrappers LLM Embeddings Llama.cpp# This page covers how to use llama.cpp within LangChain. It is broken into two parts: installation and setup, and then references to specific Llama-cpp wrappers. Installation and Setup# Install the Python package with pip install lla...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/llamacpp.html
5d5c171ee09e-0
.ipynb .pdf ClearML Integration Contents Getting API Credentials Setting Up Scenario 1: Just an LLM Scenario 2: Creating an agent with tools Tips and Next Steps ClearML Integration# In order to properly keep track of your langchain experiments and their results, you can enable the ClearML integration. ClearML is an e...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/clearml_tracking.html
5d5c171ee09e-1
# Get the OpenAI model ready to go llm = OpenAI(temperature=0, callback_manager=manager, verbose=True) The clearml callback is currently in beta and is subject to change based on updates to `langchain`. Please report any issues to https://github.com/allegroai/clearml/issues with the tag `langchain`. Scenario 1: Just an...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/clearml_tracking.html
5d5c171ee09e-2
{'action': 'on_llm_start', 'name': 'OpenAI', 'step': 3, 'starts': 2, 'ends': 1, 'errors': 0, 'text_ctr': 0, 'chain_starts': 0, 'chain_ends': 0, 'llm_starts': 2, 'llm_ends': 1, 'llm_streams': 0, 'tool_starts': 0, 'tool_ends': 0, 'agent_ends': 0, 'prompts': 'Tell me a poem'} {'action': 'on_llm_start', 'name': 'OpenAI', '...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/clearml_tracking.html
5d5c171ee09e-3
{'action': 'on_llm_start', 'name': 'OpenAI', 'step': 3, 'starts': 2, 'ends': 1, 'errors': 0, 'text_ctr': 0, 'chain_starts': 0, 'chain_ends': 0, 'llm_starts': 2, 'llm_ends': 1, 'llm_streams': 0, 'tool_starts': 0, 'tool_ends': 0, 'agent_ends': 0, 'prompts': 'Tell me a joke'} {'action': 'on_llm_start', 'name': 'OpenAI', '...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/clearml_tracking.html
5d5c171ee09e-4
{'action': 'on_llm_end', 'token_usage_prompt_tokens': 24, 'token_usage_completion_tokens': 138, 'token_usage_total_tokens': 162, 'model_name': 'text-davinci-003', 'step': 4, 'starts': 2, 'ends': 2, 'errors': 0, 'text_ctr': 0, 'chain_starts': 0, 'chain_ends': 0, 'llm_starts': 2, 'llm_ends': 2, 'llm_streams': 0, 'tool_st...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/clearml_tracking.html
5d5c171ee09e-5
{'action': 'on_llm_end', 'token_usage_prompt_tokens': 24, 'token_usage_completion_tokens': 138, 'token_usage_total_tokens': 162, 'model_name': 'text-davinci-003', 'step': 4, 'starts': 2, 'ends': 2, 'errors': 0, 'text_ctr': 0, 'chain_starts': 0, 'chain_ends': 0, 'llm_starts': 2, 'llm_ends': 2, 'llm_streams': 0, 'tool_st...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/clearml_tracking.html
5d5c171ee09e-6
{'action': 'on_llm_end', 'token_usage_prompt_tokens': 24, 'token_usage_completion_tokens': 138, 'token_usage_total_tokens': 162, 'model_name': 'text-davinci-003', 'step': 4, 'starts': 2, 'ends': 2, 'errors': 0, 'text_ctr': 0, 'chain_starts': 0, 'chain_ends': 0, 'llm_starts': 2, 'llm_ends': 2, 'llm_streams': 0, 'tool_st...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/clearml_tracking.html
5d5c171ee09e-7
{'action': 'on_llm_end', 'token_usage_prompt_tokens': 24, 'token_usage_completion_tokens': 138, 'token_usage_total_tokens': 162, 'model_name': 'text-davinci-003', 'step': 4, 'starts': 2, 'ends': 2, 'errors': 0, 'text_ctr': 0, 'chain_starts': 0, 'chain_ends': 0, 'llm_starts': 2, 'llm_ends': 2, 'llm_streams': 0, 'tool_st...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/clearml_tracking.html
5d5c171ee09e-8
{'action': 'on_llm_end', 'token_usage_prompt_tokens': 24, 'token_usage_completion_tokens': 138, 'token_usage_total_tokens': 162, 'model_name': 'text-davinci-003', 'step': 4, 'starts': 2, 'ends': 2, 'errors': 0, 'text_ctr': 0, 'chain_starts': 0, 'chain_ends': 0, 'llm_starts': 2, 'llm_ends': 2, 'llm_streams': 0, 'tool_st...
https://langchain-cn.readthedocs.io/en/latest/ecosystem/clearml_tracking.html