id
stringlengths
14
16
text
stringlengths
31
2.41k
source
stringlengths
53
121
af8b1c7c6518-17
serialized (Dict[str, Any]) – prompts (List[str]) – kwargs (Any) – Return type None on_llm_new_token(token, **kwargs)[source] Do nothing when a new token is generated. Parameters token (str) – kwargs (Any) – Return type None on_llm_end(response, **kwargs)[source] Log the latency, error, token usage, and response...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-18
Return type None on_agent_action(action, **kwargs)[source] Do nothing when agent takes a specific action. Parameters action (langchain.schema.AgentAction) – kwargs (Any) – Return type Any on_tool_end(output, observation_prefix=None, llm_prefix=None, **kwargs)[source] Do nothing when tool ends. Parameters output (st...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-19
the input of each callback function with metadata regarding the state of LLM run, and adds the response to the list of records for both the {method}_records and action. It then logs the response to mlflow server. on_llm_start(serialized, prompts, **kwargs)[source] Run when LLM starts. Parameters serialized (Dict[str, ...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-20
kwargs (Any) – Return type None on_tool_start(serialized, input_str, **kwargs)[source] Run when tool starts running. Parameters serialized (Dict[str, Any]) – input_str (str) – kwargs (Any) – Return type None on_tool_end(output, **kwargs)[source] Run when tool ends running. Parameters output (str) – kwargs (Any) ...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-21
completion_tokens: int = 0 successful_requests: int = 0 total_cost: float = 0.0 property always_verbose: bool Whether to call verbose callbacks even if verbose is False. on_llm_start(serialized, prompts, **kwargs)[source] Print out the prompts. Parameters serialized (Dict[str, Any]) – prompts (List[str]) – kwarg...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-22
Return type None on_llm_error(error, **kwargs)[source] Do nothing. Parameters error (Union[Exception, KeyboardInterrupt]) – kwargs (Any) – Return type None on_chain_start(serialized, inputs, **kwargs)[source] Print out that we are entering a chain. Parameters serialized (Dict[str, Any]) – inputs (Dict[str, Any]) –...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-23
kwargs (Any) – Return type None on_tool_error(error, **kwargs)[source] Do nothing. Parameters error (Union[Exception, KeyboardInterrupt]) – kwargs (Any) – Return type None on_text(text, color=None, end='', **kwargs)[source] Run when agent ends. Parameters text (str) – color (Optional[str]) – end (str) – kwargs ...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-24
Run when LLM errors. Parameters error (Union[Exception, KeyboardInterrupt]) – kwargs (Any) – Return type None on_chain_start(serialized, inputs, **kwargs)[source] Run when chain starts running. Parameters serialized (Dict[str, Any]) – inputs (Dict[str, Any]) – kwargs (Any) – Return type None on_chain_end(outputs,...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-25
Parameters text (str) – kwargs (Any) – Return type None on_agent_finish(finish, **kwargs)[source] Run on agent end. Parameters finish (langchain.schema.AgentFinish) – kwargs (Any) – Return type None langchain.callbacks.StreamlitCallbackHandler(parent_container, *, max_thought_containers=4, expand_new_thoughts=True...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-26
has a more recent StreamlitCallbackHandler implementation, an instance of that class will be used. Return type BaseCallbackHandler class langchain.callbacks.LLMThoughtLabeler[source] Bases: object Generates markdown labels for LLMThought containers. Pass a custom subclass of this to StreamlitCallbackHandler to overrid...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-27
project (str) – The project to log to. entity (str) – The entity to log to. tags (list) – The tags to log. group (str) – The group to log to. name (str) – The name of the run. notes (str) – The notes to log. visualize (bool) – Whether to visualize the run. complexity_metrics (bool) – Whether to log complexity metrics. ...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-28
None on_chain_start(serialized, inputs, **kwargs)[source] Run when chain starts running. Parameters serialized (Dict[str, Any]) – inputs (Dict[str, Any]) – kwargs (Any) – Return type None on_chain_end(outputs, **kwargs)[source] Run when chain ends running. Parameters outputs (Dict[str, Any]) – kwargs (Any) – Ret...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-29
Run on agent action. Parameters action (langchain.schema.AgentAction) – kwargs (Any) – Return type Any flush_tracker(langchain_asset=None, reset=True, finish=False, job_type=None, project=None, entity=None, tags=None, group=None, name=None, notes=None, visualize=None, complexity_metrics=None)[source] Flush the track...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-30
kwargs (Any) – Return type None on_llm_new_token(token, **kwargs)[source] Do nothing. Parameters token (str) – kwargs (Any) – Return type None on_llm_error(error, **kwargs)[source] Do nothing. Parameters error (Union[Exception, KeyboardInterrupt]) – kwargs (Any) – Return type None on_chain_start(serialized, inpu...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-31
color (Optional[str]) – observation_prefix (Optional[str]) – llm_prefix (Optional[str]) – kwargs (Any) – Return type None on_tool_error(error, **kwargs)[source] Do nothing. Parameters error (Union[Exception, KeyboardInterrupt]) – kwargs (Any) – Return type None on_text(text, **kwargs)[source] Do nothing. Parame...
https://api.python.langchain.com/en/stable/modules/callbacks.html
af8b1c7c6518-32
sentiment analysis compound score. Defaults to False and will not gather this metric. toxicity (bool) – If True will initialize a model to score toxicity. Defaults to False and will not gather this metric. themes (bool) – If True will initialize a model to calculate distance to configured themes. Defaults to None and w...
https://api.python.langchain.com/en/stable/modules/callbacks.html
03d1ebe9f490-0
Agents Interface for agents. class langchain.agents.Agent(*, llm_chain, output_parser, allowed_tools=None)[source] Bases: langchain.agents.agent.BaseSingleActionAgent Class responsible for calling the language model and deciding the action. This is driven by an LLMChain. The prompt in the LLMChain MUST include a vari...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-1
dict(**kwargs)[source] Return dictionary representation of agent. Parameters kwargs (Any) – Return type Dict classmethod from_llm_and_tools(llm, tools, callback_manager=None, output_parser=None, **kwargs)[source] Construct an agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – ...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-2
Return response when agent has been stopped due to max iterations. Parameters early_stopping_method (str) – intermediate_steps (List[Tuple[langchain.schema.AgentAction, str]]) – kwargs (Any) – Return type langchain.schema.AgentFinish tool_run_logging_kwargs()[source] Return type Dict abstract property llm_prefix: s...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-3
Return type None attribute agent: Union[BaseSingleActionAgent, BaseMultiActionAgent] [Required] The agent to run for creating a plan and determining actions to take at each step of the execution loop. attribute early_stopping_method: str = 'force' The method to use for early stopping if the agent never returns AgentF...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-4
The valid tools the agent can call. classmethod from_agent_and_tools(agent, tools, callback_manager=None, **kwargs)[source] Create from agent and tools. Parameters agent (Union[langchain.agents.agent.BaseSingleActionAgent, langchain.agents.agent.BaseMultiActionAgent]) – tools (Sequence[langchain.tools.base.BaseTool])...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-5
SELF_ASK_WITH_SEARCH = 'self-ask-with-search' CONVERSATIONAL_REACT_DESCRIPTION = 'conversational-react-description' CHAT_ZERO_SHOT_REACT_DESCRIPTION = 'chat-zero-shot-react-description' CHAT_CONVERSATIONAL_REACT_DESCRIPTION = 'chat-conversational-react-description' STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION = 'str...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-6
along with observations callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Callbacks to run. **kwargs – User inputs. kwargs (Any) – Returns Actions specifying what tool to use. Return type Union[List[langchain.schema.AgentAction], langchain.s...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-7
**kwargs – User inputs. kwargs (Any) – Returns Action specifying what tool to use. Return type Union[langchain.schema.AgentAction, langchain.schema.AgentFinish] dict(**kwargs)[source] Return dictionary representation of agent. Parameters kwargs (Any) – Return type Dict classmethod from_llm_and_tools(llm, tools, call...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-8
Return type langchain.schema.AgentFinish save(file_path)[source] Save the agent. Parameters file_path (Union[pathlib.Path, str]) – Path to file to save the agent to. Return type None Example: .. code-block:: python # If working with agent executor agent.agent.save(file_path=”path/agent.yaml”) tool_run_logging_kwargs()...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-9
classmethod create_prompt(tools, prefix='Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able t...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-10
MUST use the format:\n\n```\nThought: Do I need to use a tool? No\n{ai_prefix}: [your response here]\n```', ai_prefix='AI', human_prefix='Human', input_variables=None)[source]
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-11
Create prompt in the style of the zero shot agent. Parameters tools (Sequence[langchain.tools.base.BaseTool]) – List of tools the agent will have access to, used to format the prompt. prefix (str) – String to put before the list of tools. suffix (str) – String to put after the list of tools. ai_prefix (str) – String to...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-12
classmethod from_llm_and_tools(llm, tools, callback_manager=None, output_parser=None, prefix='Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide rang...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-13
say to the Human, or if you do not need to use a tool, you MUST use the format:\n\n```\nThought: Do I need to use a tool? No\n{ai_prefix}: [your response here]\n```', ai_prefix='AI', human_prefix='Human', input_variables=None, **kwargs)[source]
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-14
Construct an agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – tools (Sequence[langchain.tools.base.BaseTool]) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – output_parser (Optional[langchain.agents.agent.AgentOutputParser]) – prefix (str) – su...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-15
None attribute output_parser: langchain.agents.agent.AgentOutputParser [Optional] attribute template_tool_response: str = "TOOL RESPONSE: \n---------------------\n{observation}\n\nUSER'S INPUT\n--------------------\n\nOkay, so what is the response to my last comment? If using information obtained from the tools you mu...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-16
classmethod create_prompt(tools, system_message='Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant i...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-17
human_message (str) – input_variables (Optional[List[str]]) – output_parser (Optional[langchain.schema.BaseOutputParser]) – Return type langchain.prompts.base.BasePromptTemplate
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-18
Return type langchain.prompts.base.BasePromptTemplate classmethod from_llm_and_tools(llm, tools, callback_manager=None, output_parser=None, system_message='Assistant is a large language model trained by OpenAI.\n\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to ...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-19
Parameters llm (langchain.base_language.BaseLanguageModel) – tools (Sequence[langchain.tools.base.BaseTool]) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – output_parser (Optional[langchain.agents.agent.AgentOutputParser]) – system_message (str) – human_message (str) – input_variabl...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-20
kwargs (Any) – Returns Action specifying what tool to use. Return type Union[langchain.schema.AgentAction, langchain.schema.AgentFinish] dict(**kwargs)[source] Return dictionary representation of agent. Parameters kwargs (Any) – Return type Dict plan(intermediate_steps, callbacks=None, **kwargs)[source] Given input...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-21
Parameters memory (Optional[langchain.schema.BaseMemory]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – verbose (bool) – tags (Optional[List[str]]) – agent...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-22
llm_math_chain = LLMMathChain(llm=llm) chains = [ ChainConfig( action_name = "Search", action=search.search, action_description="useful for searching" ), ChainConfig( action_name="Calculator", action=llm_math_chain.run, action_description="useful for doing mat...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-23
along with observations **kwargs – User inputs. callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Returns Action specifying what tool to use. Return type Union[langchain.schema.AgentAction, langchain.schema.AgentFinish] class...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-24
List[str] plan(intermediate_steps, callbacks=None, **kwargs)[source] Given input, decided what to do. Parameters intermediate_steps (List[Tuple[langchain.schema.AgentAction, str]]) – Steps the LLM has taken to date, along with observations **kwargs – User inputs. callbacks (Optional[Union[List[langchain.callbacks.base...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-25
verbose (bool) – tags (Optional[List[str]]) – agent (Union[langchain.agents.agent.BaseSingleActionAgent, langchain.agents.agent.BaseMultiActionAgent]) – tools (Sequence[langchain.tools.base.BaseTool]) – return_intermediate_steps (bool) – max_iterations (Optional[int]) – max_execution_time (Optional[float]) – ear...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-26
search_chain = GoogleSerperAPIWrapper() self_ask = SelfAskWithSearchChain(llm=OpenAI(), search_chain=search_chain) Parameters llm (langchain.base_language.BaseLanguageModel) – search_chain (Union[langchain.utilities.google_serper.GoogleSerperAPIWrapper, langchain.utilities.serpapi.SerpAPIWrapper]) – memory (Optional[...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-27
None attribute output_parser: langchain.agents.agent.AgentOutputParser [Optional] classmethod create_prompt(tools, prefix='Respond to the human as helpfully and accurately as possible. You have access to the following tools:', suffix='Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use too...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-28
format_instructions (str) – input_variables (Optional[List[str]]) – memory_prompts (Optional[List[langchain.prompts.base.BasePromptTemplate]]) – Return type langchain.prompts.base.BasePromptTemplate classmethod from_llm_and_tools(llm, tools, callback_manager=None, output_parser=None, prefix='Respond to the human as ...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-29
Parameters llm (langchain.base_language.BaseLanguageModel) – tools (Sequence[langchain.tools.base.BaseTool]) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – output_parser (Optional[langchain.agents.agent.AgentOutputParser]) – prefix (str) – suffix (str) – human_message_template (str)...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-30
Return type None attribute coroutine: Optional[Callable[[...], Awaitable[str]]] = None The asynchronous version of the function. attribute description: str = '' Used to tell the model how/when/why to use the tool. You can provide few-shot examples as a part of the description. attribute func: Callable[[...], str] [Re...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-31
None attribute output_parser: langchain.agents.agent.AgentOutputParser [Optional] classmethod create_prompt(tools, prefix='Answer the following questions as best you can. You have access to the following tools:', suffix='Begin!\n\nQuestion: {input}\nThought:{agent_scratchpad}', format_instructions='Use the following f...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-32
Return type langchain.prompts.prompt.PromptTemplate classmethod from_llm_and_tools(llm, tools, callback_manager=None, output_parser=None, prefix='Answer the following questions as best you can. You have access to the following tools:', suffix='Begin!\n\nQuestion: {input}\nThought:{agent_scratchpad}', format_instruction...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-33
Parameters llm (langchain.base_language.BaseLanguageModel) – path (Union[str, List[str]]) – pandas_kwargs (Optional[dict]) – kwargs (Any) – Return type langchain.agents.agent.AgentExecutor
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-34
langchain.agents.create_json_agent(llm, toolkit, callback_manager=None, prefix='You are an agent designed to interact with JSON.\nYour goal is to return a final answer by interacting with the JSON.\nYou have access to the following tools which help you learn more about the JSON you are interacting with.\nOnly use the b...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-35
the JSON, as this is not a valid answer. Keep digging until you find the answer and explicitly return it.\n', suffix='Begin!"\n\nQuestion: {input}\nThought: I should look at the keys that exist in data to see what I have access to\n{agent_scratchpad}', format_instructions='Use the following format:\n\nQuestion: the inp...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-36
Construct a json agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.json.toolkit.JsonToolkit) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (str) – suffix (str) – format_instructions (str) – inpu...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-37
langchain.agents.create_openapi_agent(llm, toolkit, callback_manager=None, prefix="You are an agent designed to answer questions by making web requests to an API given the openapi spec.\n\nIf the question does not seem related to the API, return I don't know. Do not make up an answer.\nOnly use information provided by ...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-38
Input/Observation can repeat N times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question', input_variables=None, max_iterations=15, max_execution_time=None, early_stopping_method='force', verbose=False, return_intermediate_steps=False, agent_executor_kwargs=None, **kwar...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-39
Construct a json agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.openapi.toolkit.OpenAPIToolkit) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (str) – suffix (str) – format_instructions (str) –...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-40
max_iterations (Optional[int]) – max_execution_time (Optional[float]) – early_stopping_method (str) – agent_executor_kwargs (Optional[Dict[str, Any]]) – include_df_in_prompt (Optional[bool]) – kwargs (Dict[str, Any]) – Return type langchain.agents.agent.AgentExecutor
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-41
langchain.agents.create_pbi_agent(llm, toolkit, powerbi=None, callback_manager=None, prefix='You are an agent designed to help users interact with a PowerBI Dataset.\n\nAgent has access to a tool that can write a query based on the question and then run those against PowerBI, Microsofts business intelligence tool. The ...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-42
Answer: the final answer to the original input question', examples=None, input_variables=None, top_k=10, verbose=False, agent_executor_kwargs=None, **kwargs)[source]
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-43
Construct a pbi agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit]) – powerbi (Optional[langchain.utilities.powerbi.PowerBIDataset]) – callback_manager (Optional[langchain.callbacks.base.BaseCallb...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-44
Return type langchain.agents.agent.AgentExecutor langchain.agents.create_pbi_chat_agent(llm, toolkit, powerbi=None, callback_manager=None, output_parser=None, prefix='Assistant is a large language model built to help users interact with a PowerBI Dataset.\n\nAssistant has access to a tool that can write a query based o...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-45
Construct a pbi agent from an Chat LLM and tools. If you supply only a toolkit and no powerbi dataset, the same LLM is used for both. Parameters llm (langchain.chat_models.base.BaseChatModel) – toolkit (Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit]) – powerbi (Optional[langchain.utilities.p...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-46
df (Any) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (str) – suffix (str) – input_variables (Optional[List[str]]) – verbose (bool) – return_intermediate_steps (bool) – max_iterations (Optional[int]) – max_execution_time (Optional[float]) – early_stopping_method (str) – ...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-47
langchain.agents.create_spark_sql_agent(llm, toolkit, callback_manager=None, prefix='You are an agent designed to interact with Spark SQL.\nGiven an input question, create a syntactically correct Spark SQL query to run, then look at the results of the query and return the answer.\nUnless the user specifies a specific n...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-48
Answer: the final answer to the original input question', input_variables=None, top_k=10, max_iterations=15, max_execution_time=None, early_stopping_method='force', verbose=False, agent_executor_kwargs=None, **kwargs)[source]
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-49
Construct a sql agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.spark_sql.toolkit.SparkSQLToolkit) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefix (str) – suffix (str) – format_instructions (str)...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-50
langchain.agents.create_sql_agent(llm, toolkit, agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION, callback_manager=None, prefix='You are an agent designed to interact with a SQL database.\nGiven an input question, create a syntactically correct {dialect} query to run, then look at the results of the query and return th...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-51
max_execution_time=None, early_stopping_method='force', verbose=False, agent_executor_kwargs=None, **kwargs)[source]
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-52
Construct a sql agent from an LLM and tools. Parameters llm (langchain.base_language.BaseLanguageModel) – toolkit (langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit) – agent_type (langchain.agents.agent_types.AgentType) – callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – prefi...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-53
prefix (str) – verbose (bool) – agent_executor_kwargs (Optional[Dict[str, Any]]) – kwargs (Dict[str, Any]) – Return type langchain.agents.agent.AgentExecutor langchain.agents.create_vectorstore_router_agent(llm, toolkit, callback_manager=None, prefix='You are an agent designed to answer questions.\nYou have access ...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-54
llm (langchain.base_language.BaseLanguageModel) – Language model to use as the agent. agent (Optional[langchain.agents.agent_types.AgentType]) – Agent type to use. If None and agent_path is also None, will default to AgentType.ZERO_SHOT_REACT_DESCRIPTION. callback_manager (Optional[langchain.callbacks.base.BaseCallback...
https://api.python.langchain.com/en/stable/modules/agents.html
03d1ebe9f490-55
Returns A tool. Return type langchain.tools.base.BaseTool langchain.agents.load_tools(tool_names, llm=None, callbacks=None, **kwargs)[source] Load tools based on their name. Parameters tool_names (List[str]) – name of tools to load. llm (Optional[langchain.base_language.BaseLanguageModel]) – Optional language model, m...
https://api.python.langchain.com/en/stable/modules/agents.html
4c9e56a69292-0
Document Loaders All different types of document loaders. class langchain.document_loaders.AcreomLoader(path, encoding='UTF-8', collect_metadata=True)[source] Bases: langchain.document_loaders.base.BaseLoader Parameters path (str) – encoding (str) – collect_metadata (bool) – FRONT_MATTER_REGEX = re.compile('^---\\...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-1
Loader for Airtable tables. Parameters api_token (str) – table_id (str) – base_id (str) – lazy_load()[source] Lazy load records from table. Return type Iterator[langchain.schema.Document] load()[source] Load Table. Return type List[langchain.schema.Document] class langchain.document_loaders.ApifyDatasetLoader(data...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-2
Load data into document objects. Return type List[langchain.schema.Document] class langchain.document_loaders.AzureBlobStorageContainerLoader(conn_str, container, prefix='')[source] Bases: langchain.document_loaders.base.BaseLoader Loading logic for loading documents from Azure Blob Storage. Parameters conn_str (str) ...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-3
Loads a bibtex file into a list of Documents. Each document represents one entry from the bibtex file. If a PDF file is present in the file bibtex field, the original PDF is loaded into the document text. If no such file entry is present, the abstract field is used instead. Parameters file_path (str) – parser (Optiona...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-4
are written into the page_content and none into the metadata. Parameters query (str) – project (Optional[str]) – page_content_columns (Optional[List[str]]) – metadata_columns (Optional[List[str]]) – credentials (Optional[Credentials]) – load()[source] Load data into document objects. Return type List[langchain.sc...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-5
blackboard_course_url (str) – bbrouter (str) – load_all_recursively (bool) – basic_auth (Optional[Tuple[str, str]]) – cookies (Optional[dict]) – folder_path: str base_url: str load_all_recursively: bool check_bs4()[source] Check if BeautifulSoup4 is installed. Raises ImportError – If BeautifulSoup4 is not inst...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-6
None attribute data: Optional[Union[bytes, str]] = None attribute encoding: str = 'utf-8' attribute mimetype: Optional[str] = None attribute path: Optional[Union[str, pathlib.PurePath]] = None as_bytes()[source] Read data as bytes. Return type bytes as_bytes_io()[source] Read data as a byte stream. Return type Ge...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-7
if a mime-type was not provided Returns Blob instance Return type langchain.document_loaders.blob_loaders.schema.Blob property source: Optional[str] The source location of the blob as string if known otherwise none. class langchain.document_loaders.BlobLoader[source] Bases: abc.ABC Abstract interface for blob loaders...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-8
Default value is false for this reason. The max_execution_time (sec) can be set to limit the execution time of the loader. Future versions of this loader can: Support additional Alchemy APIs (e.g. getTransactions, etc.) Support additional blockain APIs (e.g. Infura, Opensea, etc.) Parameters contract_address (str) – b...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-9
load()[source] Load data into document objects. Return type List[langchain.schema.Document] class langchain.document_loaders.ChatGPTLoader(log_file, num_logs=- 1)[source] Bases: langchain.document_loaders.base.BaseLoader Loader that loads conversations from exported ChatGPT data. Parameters log_file (str) – num_logs...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-10
Load Confluence pages. Port of https://llamahub.ai/l/confluence This currently supports username/api_key, Oauth2 login or personal access token authentication. Specify a list page_ids and/or space_key to load in the corresponding pages into Document objects, if both are specified the union of both sets will be returned...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-11
token (str, optional) – _description_, defaults to None cloud (bool, optional) – _description_, defaults to True number_of_retries (Optional[int], optional) – How many times to retry, defaults to 3 min_retry_seconds (Optional[int], optional) – defaults to 2 max_retry_seconds (Optional[int], optional) – defaults to 10 c...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-12
defaults to False include_attachments (bool, optional) – defaults to False include_comments (bool, optional) – defaults to False content_format (ContentFormat) – Specify content format, defaults to ContentFormat.STORAGE limit (int, optional) – Maximum number of pages to retrieve per request, defaults to 50 max_pages (i...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-13
List of documents Return type List is_public_page(page)[source] Check if a page is publicly accessible. Parameters page (dict) – Return type bool process_pages(pages, include_restricted_content, include_attachments, include_comments, content_format, ocr_languages=None)[source] Process a list of pages into a list of ...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-14
Parameters link (str) – Return type str process_svg(link, ocr_languages=None)[source] Parameters link (str) – ocr_languages (Optional[str]) – Return type str class langchain.document_loaders.DataFrameLoader(data_frame, page_content_column='text')[source] Bases: langchain.document_loaders.base.BaseLoader Load Panda...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-15
silent_errors (bool) – load_hidden (bool) – loader_cls (Union[Type[langchain.document_loaders.unstructured.UnstructuredFileLoader], Type[langchain.document_loaders.text.TextLoader], Type[langchain.document_loaders.html_bs.BSHTMLLoader]]) – loader_kwargs (Optional[dict]) – recursive (bool) – show_progress (bool) – ...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-16
Parameters api (str) – access_token (Optional[str]) – docset_id (Optional[str]) – document_ids (Optional[Sequence[str]]) – file_paths (Optional[Sequence[Union[pathlib.Path, str]]]) – min_chunk_size (int) – Return type None attribute access_token: Optional[str] = None attribute api: str = 'https://api.docugami.co...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-17
Each document represents one row of the result. The page_content_columns are written into the page_content of the document. The metadata_columns are written into the metadata of the document. By default, all columns are written into the page_content and none into the metadata. Parameters query (str) – database (str) –...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-18
"chunk_splitter": "CharacterTextSplitter" } ) blob = Blob.from_path(path="example.pdf") documents = loader.parse(blob=blob) Parameters embaas_api_key (Optional[str]) – api_url (str) – params (langchain.document_loaders.embaas.EmbaasDocumentExtractionParameters) – Return type None lazy_parse(blob)[source] Lazy p...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-19
"chunk_size": 256, "chunk_splitter": "CharacterTextSplitter" } ) documents = loader.load() Parameters embaas_api_key (Optional[str]) – api_url (str) – params (langchain.document_loaders.embaas.EmbaasDocumentExtractionParameters) – file_path (str) – blob_loader (Optional[langchain.document_loaders.embaas...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-20
Currently only the plain text in the note is extracted and stored as the contents of the Document, any non content metadata (e.g. β€˜author’, β€˜created’, β€˜updated’ etc. but not β€˜content-raw’ or β€˜resource’) tags on the note will be extracted and stored as metadata on the Document. Parameters file_path (str) – The path to t...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-21
Optional list of field names to include in metadata. Type Optional[Sequence[str]] load()[source] Load data into document objects. Return type List[langchain.schema.Document] lazy_load()[source] A lazy loader for document content. Return type Iterator[langchain.schema.Document] class langchain.document_loaders.FigmaFi...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-22
Bases: langchain.document_loaders.base.BaseLoader Loading logic for loading documents from GCS. Parameters project_name (str) – bucket (str) – prefix (str) – load()[source] Load documents. Return type List[langchain.schema.Document] class langchain.document_loaders.GCSFileLoader(project_name, bucket, blob)[source]...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-23
Return type None attribute assignee: Optional[str] = None Filter on assigned user. Pass β€˜none’ for no user and β€˜*’ for any user. attribute creator: Optional[str] = None Filter on the user that created the issue. attribute direction: Optional[Literal['asc', 'desc']] = None The direction to sort the results by. Can be...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-24
Returns page_content metadata url title creator created_at last_update_time closed_time number of comments state labels assignee assignees milestone locked number is_pull_request Return type A list of Documents with attributes load()[source] Get issues of a GitHub repository. Returns page_content metadata url title cr...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-25
Load data into document objects. Return type List[langchain.schema.Document] class langchain.document_loaders.GitbookLoader(web_page, load_all_paths=False, base_url=None, content_selector='main')[source] Bases: langchain.document_loaders.web_base.WebBaseLoader Load GitBook data. load from either a single page, or load...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-26
service_account_path: pathlib.Path = PosixPath('/home/docs/.credentials/credentials.json') token_path: pathlib.Path = PosixPath('/home/docs/.credentials/token.json') classmethod validate_channel_or_videoIds_is_set(values)[source] Validate that either folder_id or document_ids is set, but not both. Parameters values ...
https://api.python.langchain.com/en/stable/modules/document_loaders.html
4c9e56a69292-27
Return type None google_api_client: langchain.document_loaders.youtube.GoogleApiClient channel_name: Optional[str] = None video_ids: Optional[List[str]] = None add_video_info: bool = True captions_language: str = 'en' continue_on_failure: bool = False classmethod validate_channel_or_videoIds_is_set(values)[source...
https://api.python.langchain.com/en/stable/modules/document_loaders.html