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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.