id
stringlengths
14
16
text
stringlengths
31
2.41k
source
stringlengths
53
121
06ea1ea7a2ba-20
Parameters query (str) – Return type Dict[int, Tuple[langchain.schema.Document, float]] class langchain.retrievers.VespaRetriever(app, body, content_field, metadata_fields=None)[source] Bases: langchain.schema.BaseRetriever Retriever that uses the Vespa. Parameters app (Vespa) – body (Dict) – content_field (str) – ...
https://api.python.langchain.com/en/latest/modules/retrievers.html
06ea1ea7a2ba-21
from. Defaults to None. _filter (Optional[str]) – Document filter condition expressed in YQL. Defaults to None. yql (Optional[str]) – Full YQL query to be used. Should not be specified if _filter or sources are specified. Defaults to None. kwargs (Any) – Keyword arguments added to query body. Return type langchain.retr...
https://api.python.langchain.com/en/latest/modules/retrievers.html
06ea1ea7a2ba-22
Parameters query (str) – string to find relevant documents for where_filter (Optional[Dict[str, object]]) – Returns List of relevant documents Return type List[langchain.schema.Document] class langchain.retrievers.WikipediaRetriever(*, wiki_client=None, top_k_results=3, lang='en', load_all_available_meta=False, doc_co...
https://api.python.langchain.com/en/latest/modules/retrievers.html
06ea1ea7a2ba-23
More on Zep: Zep provides long-term conversation storage for LLM apps. The server stores, summarizes, embeds, indexes, and enriches conversational AI chat histories, and exposes them via simple, low-latency APIs. For server installation instructions, see: https://getzep.github.io/deployment/quickstart/ Parameters sessi...
https://api.python.langchain.com/en/latest/modules/retrievers.html
06ea1ea7a2ba-24
Add text to the Zilliz store Parameters texts (List[str]) – The text metadatas (List[dict]) – Metadata dicts, must line up with existing store Return type None get_relevant_documents(query)[source] Get documents relevant for a query. Parameters query (str) – string to find relevant documents for Returns List of releva...
https://api.python.langchain.com/en/latest/modules/retrievers.html
06ea1ea7a2ba-25
Should be an embedding/vector/tensor. content_field Field that represents the main content in your document schema. Will be used as a page_content. Everything else will go into metadata. search_type Type of search to perform (similarity / mmr) filters Filters applied for document retrieval. top_k Number of document...
https://api.python.langchain.com/en/latest/modules/retrievers.html
06ea1ea7a2ba-26
Return type None attribute transformers: List[Union[langchain.schema.BaseDocumentTransformer, langchain.retrievers.document_compressors.base.BaseDocumentCompressor]] [Required] List of document filters that are chained together and run in sequence. async acompress_documents(documents, query)[source] Compress retrieve...
https://api.python.langchain.com/en/latest/modules/retrievers.html
06ea1ea7a2ba-27
indicate greater similarity. attribute similarity_threshold: Optional[float] = None Threshold for determining when two documents are similar enough to be considered redundant. Defaults to None, must be specified if k is set to None. async acompress_documents(documents, query)[source] Filter down documents. Parameters...
https://api.python.langchain.com/en/latest/modules/retrievers.html
06ea1ea7a2ba-28
Compress page content of raw documents. Parameters documents (Sequence[langchain.schema.Document]) – query (str) – Return type Sequence[langchain.schema.Document] classmethod from_llm(llm, prompt=None, get_input=None, llm_chain_kwargs=None)[source] Initialize from LLM. Parameters llm (langchain.base_language.BaseLan...
https://api.python.langchain.com/en/latest/modules/retrievers.html
06ea1ea7a2ba-29
query (str) – Return type Sequence[langchain.schema.Document] compress_documents(documents, query)[source] Filter down documents based on their relevance to the query. Parameters documents (Sequence[langchain.schema.Document]) – query (str) – Return type Sequence[langchain.schema.Document] classmethod from_llm(llm,...
https://api.python.langchain.com/en/latest/modules/retrievers.html
d97158bcb296-0
Example Selector Logic for selecting examples to include in prompts. class langchain.prompts.example_selector.LengthBasedExampleSelector(*, examples, example_prompt, get_text_length=<function _get_length_based>, max_length=2048, example_text_lengths=[])[source] Bases: langchain.prompts.example_selector.base.BaseExamp...
https://api.python.langchain.com/en/latest/modules/example_selector.html
d97158bcb296-1
Bases: langchain.prompts.example_selector.semantic_similarity.SemanticSimilarityExampleSelector ExampleSelector that selects examples based on Max Marginal Relevance. This was shown to improve performance in this paper: https://arxiv.org/pdf/2211.13892.pdf Parameters vectorstore (langchain.vectorstores.base.VectorStore...
https://api.python.langchain.com/en/latest/modules/example_selector.html
d97158bcb296-2
Parameters input_variables (Dict[str, str]) – Return type List[dict] class langchain.prompts.example_selector.NGramOverlapExampleSelector(*, examples, example_prompt, threshold=- 1.0)[source] Bases: langchain.prompts.example_selector.base.BaseExampleSelector, pydantic.main.BaseModel Select and order examples based on...
https://api.python.langchain.com/en/latest/modules/example_selector.html
d97158bcb296-3
Excludes any examples with ngram_overlap_score less than or equal to threshold. Parameters input_variables (Dict[str, str]) – Return type List[dict] class langchain.prompts.example_selector.SemanticSimilarityExampleSelector(*, vectorstore, k=4, example_keys=None, input_keys=None)[source] Bases: langchain.prompts.exam...
https://api.python.langchain.com/en/latest/modules/example_selector.html
d97158bcb296-4
vectorstore_cls (Type[langchain.vectorstores.base.VectorStore]) – A vector store DB interface class, e.g. FAISS. k (int) – Number of examples to select input_keys (Optional[List[str]]) – If provided, the search is based on the input variables instead of all variables. vectorstore_cls_kwargs (Any) – optional kwargs cont...
https://api.python.langchain.com/en/latest/modules/example_selector.html
18d09815d48a-0
Callbacks Callback handlers that allow listening to events in LangChain. class langchain.callbacks.AimCallbackHandler(repo=None, experiment_name=None, system_tracking_interval=10, log_system_params=True)[source] Bases: langchain.callbacks.aim_callback.BaseMetadataCallbackHandler, langchain.callbacks.base.BaseCallback...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-1
Return type None on_llm_new_token(token, **kwargs)[source] Run when LLM generates a new token. Parameters token (str) – kwargs (Any) – Return type None on_llm_error(error, **kwargs)[source] Run when LLM errors. Parameters error (Union[Exception, KeyboardInterrupt]) – kwargs (Any) – Return type None on_chain_start...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-2
Return type None on_text(text, **kwargs)[source] Run when agent is ending. Parameters text (str) – kwargs (Any) – Return type None on_agent_finish(finish, **kwargs)[source] Run when agent ends running. Parameters finish (langchain.schema.AgentFinish) – kwargs (Any) – Return type None on_agent_action(action, **kwa...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-3
Bases: langchain.callbacks.base.BaseCallbackHandler Callback Handler that logs into Argilla. Parameters dataset_name (str) – name of the FeedbackDataset in Argilla. Note that it must exist in advance. If you need help on how to create a FeedbackDataset in Argilla, please visit https://docs.argilla.io/en/latest/guides/l...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-4
... callbacks=[argilla_callback], ... verbose=True, ... openai_api_key="API_KEY_HERE", ... ) >>> llm.generate([ ... "What is the best NLP-annotation tool out there? (no bias at all)", ... ]) "Argilla, no doubt about it." on_llm_start(serialized, prompts, **kwargs)[source] Save the prompts in memory whe...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-5
kwargs (Any) – Return type None on_chain_end(outputs, **kwargs)[source] If either the parent_run_id or the run_id is in self.prompts, then log the outputs to Argilla, and pop the run from self.prompts. The behavior differs if the output is a list or not. Parameters outputs (Dict[str, Any]) – kwargs (Any) – Return t...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-6
Do nothing Parameters text (str) – kwargs (Any) – Return type None on_agent_finish(finish, **kwargs)[source] Do nothing Parameters finish (langchain.schema.AgentFinish) – kwargs (Any) – Return type None class langchain.callbacks.ArizeCallbackHandler(model_id=None, model_version=None, SPACE_KEY=None, API_KEY=None)[...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-7
inputs (Dict[str, Any]) – kwargs (Any) – Return type None on_chain_end(outputs, **kwargs)[source] Do nothing. Parameters outputs (Dict[str, Any]) – kwargs (Any) – Return type None on_chain_error(error, **kwargs)[source] Do nothing. Parameters error (Union[Exception, KeyboardInterrupt]) – kwargs (Any) – Return t...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-8
kwargs (Any) – Return type None class langchain.callbacks.AsyncIteratorCallbackHandler[source] Bases: langchain.callbacks.base.AsyncCallbackHandler Callback handler that returns an async iterator. Return type None property always_verbose: bool queue: asyncio.queues.Queue[str] done: asyncio.locks.Event async on_llm...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-9
Callback Handler that logs to ClearML. Parameters job_type (str) – The type of clearml task such as β€œinference”, β€œtesting” or β€œqc” project_name (str) – The clearml project name tags (list) – Tags to add to the task task_name (str) – Name of the clearml task visualize (bool) – Whether to visualize the run. complexity_me...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-10
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, **kwargs)[source] Run when chain ends running. Parameters outputs (Dict[str, ...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-11
Return type None on_agent_action(action, **kwargs)[source] Run on agent action. Parameters action (langchain.schema.AgentAction) – kwargs (Any) – Return type Any analyze_text(text)[source] Analyze text using textstat and spacy. Parameters text (str) – The text to analyze. Returns A dictionary containing the complex...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-12
workspace (Optional[str]) – name (Optional[str]) – visualizations (Optional[List[str]]) – custom_metrics (Optional[Callable]) – Return type None This handler will utilize the associated callback method and formats the input of each callback function with metadata regarding the state of LLM run, and adds the respons...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-13
kwargs (Any) – Return type None on_chain_error(error, **kwargs)[source] Run when chain errors. Parameters error (Union[Exception, KeyboardInterrupt]) – kwargs (Any) – Return type None on_tool_start(serialized, input_str, **kwargs)[source] Run when tool starts running. Parameters serialized (Dict[str, Any]) – inpu...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-14
Flush the tracker and setup the session. Everything after this will be a new table. Parameters name (Optional[str]) – Name of the preformed session so far so it is identifyable langchain_asset (Any) – The langchain asset to save. finish (bool) – Whether to finish the run. Returns – None task_type (Optional[str]) – wor...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-15
color (Optional[str]) – kwargs (Any) – Return type Any on_tool_end(output, color=None, observation_prefix=None, llm_prefix=None, **kwargs)[source] If not the final action, print out observation. Parameters output (str) – color (Optional[str]) – observation_prefix (Optional[str]) – llm_prefix (Optional[str]) – kw...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-16
Run when LLM starts running. Parameters serialized (Dict[str, Any]) – prompts (List[str]) – kwargs (Any) – Return type None on_llm_new_token(token, **kwargs)[source] Run on new LLM token. Only available when streaming is enabled. Parameters token (str) – kwargs (Any) – Return type None class langchain.callbacks.H...
https://api.python.langchain.com/en/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
18d09815d48a-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/latest/modules/callbacks.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-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/latest/modules/agents.html
f5ed643c3227-51
max_execution_time=None, early_stopping_method='force', verbose=False, agent_executor_kwargs=None, **kwargs)[source]
https://api.python.langchain.com/en/latest/modules/agents.html