id stringlengths 14 16 | text stringlengths 29 2.73k | source stringlengths 49 117 |
|---|---|---|
5adedfb1d4b5-7 | powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n\nTOOLS:\n------\n\nAssistant has access to the follo... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-8 | 'AI', human_prefix: str = 'Human', input_variables: Optional[List[str]] = None) → langchain.prompts.prompt.PromptTemplate[source]# | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-9 | Create prompt in the style of the zero shot agent.
Parameters
tools – List of tools the agent will have access to, used to format the
prompt.
prefix – String to put before the list of tools.
suffix – String to put after the list of tools.
ai_prefix – String to use before AI output.
human_prefix – String to use before h... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-10 | classmethod from_llm_and_tools(llm: langchain.base_language.BaseLanguageModel, tools: Sequence[langchain.tools.base.BaseTool], callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, output_parser: Optional[langchain.agents.agent.AgentOutputParser] = None, prefix: str = 'Assistant is a large la... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-11 | receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-12 | the format:\n\n```\nThought: Do I need to use a tool? No\n{ai_prefix}: [your response here]\n```', ai_prefix: str = 'AI', human_prefix: str = 'Human', input_variables: Optional[List[str]] = None, **kwargs: Any) → langchain.agents.agent.Agent[source]# | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-13 | Construct an agent from an LLM and tools.
property llm_prefix: str#
Prefix to append the llm call with.
property observation_prefix: str#
Prefix to append the observation with.
pydantic model langchain.agents.ConversationalChatAgent[source]#
An agent designed to hold a conversation in addition to using tools.
field out... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-14 | classmethod create_prompt(tools: Sequence[langchain.tools.base.BaseTool], system_message: str = '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 r... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-15 | classmethod from_llm_and_tools(llm: langchain.base_language.BaseLanguageModel, tools: Sequence[langchain.tools.base.BaseTool], callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, output_parser: Optional[langchain.agents.agent.AgentOutputParser] = None, system_message: str = 'Assistant is a ... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-16 | it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific questi... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-17 | Construct an agent from an LLM and tools.
property llm_prefix: str#
Prefix to append the llm call with.
property observation_prefix: str#
Prefix to append the observation with.
pydantic model langchain.agents.LLMSingleActionAgent[source]#
field llm_chain: langchain.chains.llm.LLMChain [Required]#
field output_parser: l... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-18 | pydantic model langchain.agents.MRKLChain[source]#
Chain that implements the MRKL system.
Example
from langchain import OpenAI, MRKLChain
from langchain.chains.mrkl.base import ChainConfig
llm = OpenAI(temperature=0)
prompt = PromptTemplate(...)
chains = [...]
mrkl = MRKLChain.from_chains(llm=llm, prompt=prompt)
Valida... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-19 | action_description="useful for doing math"
)
]
mrkl = MRKLChain.from_chains(llm, chains)
pydantic model langchain.agents.ReActChain[source]#
Chain that implements the ReAct paper.
Example
from langchain import ReActChain, OpenAI
react = ReAct(llm=OpenAI())
Validators
raise_deprecation » all fields
set_verbose » ver... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-20 | field output_parser: langchain.agents.agent.AgentOutputParser [Optional]#
classmethod create_prompt(tools: Sequence[langchain.tools.base.BaseTool], prefix: str = 'Respond to the human as helpfully and accurately as possible. You have access to the following tools:', suffix: str = 'Begin! Reminder to ALWAYS respond with... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-21 | classmethod from_llm_and_tools(llm: langchain.base_language.BaseLanguageModel, tools: Sequence[langchain.tools.base.BaseTool], callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, output_parser: Optional[langchain.agents.agent.AgentOutputParser] = None, prefix: str = 'Respond to the human as... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-22 | Construct an agent from an LLM and tools.
property llm_prefix: str#
Prefix to append the llm call with.
property observation_prefix: str#
Prefix to append the observation with.
pydantic model langchain.agents.Tool[source]#
Tool that takes in function or coroutine directly.
field coroutine: Optional[Callable[[...], Awai... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-23 | field output_parser: langchain.agents.agent.AgentOutputParser [Optional]#
classmethod create_prompt(tools: Sequence[langchain.tools.base.BaseTool], prefix: str = 'Answer the following questions as best you can. You have access to the following tools:', suffix: str = 'Begin!\n\nQuestion: {input}\nThought:{agent_scratchp... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-24 | Returns
A PromptTemplate with the template assembled from the pieces here.
classmethod from_llm_and_tools(llm: langchain.base_language.BaseLanguageModel, tools: Sequence[langchain.tools.base.BaseTool], callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, output_parser: Optional[langchain.age... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-25 | langchain.agents.create_json_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.json.toolkit.JsonToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with JSON.\nYour goal is to return a... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-26 | use it.\nYou should only add one key at a time to the path. You cannot add multiple keys at once.\nIf you encounter a "KeyError", go back to the previous key, look at the available keys, and try again.\n\nIf the question does not seem to be related to the JSON, just return "I don\'t know" as the answer.\nAlways begin y... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-27 | '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: str = 'Use the following format:\n\nQuestion: the input question you must answer\nThought: you should always think about what to do\nAction: the action to take, sh... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-28 | Construct a json agent from an LLM and tools. | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-29 | langchain.agents.create_openapi_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.openapi.toolkit.OpenAPIToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = "You are an agent designed to answer questions by making web reque... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-30 | which parameters are required. For parameters with a fixed set of values, please use the spec to look at which values are allowed.\n\nUse the exact parameter names as listed in the spec, do not make up any names or abbreviate the names of parameters.\nIf you get a not found error, ensure that you are using a path that ... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-31 | None, max_iterations: Optional[int] = 15, max_execution_time: Optional[float] = None, early_stopping_method: str = 'force', verbose: bool = False, return_intermediate_steps: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict[str, Any]) → langchain.agents.agent.AgentExecutor[source]# | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-32 | Construct a json agent from an LLM and tools.
langchain.agents.create_pandas_dataframe_agent(llm: langchain.base_language.BaseLanguageModel, df: Any, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: Optional[str] = None, suffix: Optional[str] = None, input_variables: Optional[Lis... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-33 | langchain.agents.create_pbi_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit], powerbi: Optional[langchain.utilities.powerbi.PowerBIDataset] = None, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, pref... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-34 | format for a human, also make sure to represent numbers in readable ways, like 1M instead of 1000000. Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results.\n', suffix: str = 'Begin!\n\nQuestion: {input}\nThought: I can first ask which tables I h... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-35 | Optional[List[str]] = None, top_k: int = 10, verbose: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict[str, Any]) → langchain.agents.agent.AgentExecutor[source]# | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-36 | Construct a pbi agent from an LLM and tools. | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-37 | langchain.agents.create_pbi_chat_agent(llm: langchain.chat_models.base.BaseChatModel, toolkit: Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit], powerbi: Optional[langchain.utilities.powerbi.PowerBIDataset] = None, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, ... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-38 | rows are asked find a way to write that in a easily readible format for a human, also make sure to represent numbers in readable ways, like 1M instead of 1000000. Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results.\n', suffix: str = "TOOLS\n--... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-39 | 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.
langchain.agents.create_spark_dataframe_agent(llm: langchain.llms.base.BaseLLM, df: Any, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = '\... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-40 | langchain.agents.create_spark_sql_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.spark_sql.toolkit.SparkSQLToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with Spark SQL.\nGiven... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-41 | rewrite the query and try again.\n\nDO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.\n\nIf the question does not seem related to the database, just return "I don\'t know" as the answer.\n', suffix: str = 'Begin!\n\nQuestion: {input}\nThought: I should look at the tables in the databas... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-42 | str = 'force', verbose: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict[str, Any]) → langchain.agents.agent.AgentExecutor[source]# | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-43 | Construct a sql agent from an LLM and tools. | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-44 | langchain.agents.create_sql_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with a SQL database.\nGiven an ... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-45 | rewrite the query and try again.\n\nDO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.\n\nIf the question does not seem related to the database, just return "I don\'t know" as the answer.\n', suffix: str = 'Begin!\n\nQuestion: {input}\nThought: I should look at the tables in the databas... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-46 | str = 'force', verbose: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict[str, Any]) → langchain.agents.agent.AgentExecutor[source]# | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-47 | Construct a sql agent from an LLM and tools.
langchain.agents.create_vectorstore_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are ... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-48 | Construct a vectorstore router agent from an LLM and tools.
langchain.agents.get_all_tool_names() → List[str][source]#
Get a list of all possible tool names.
langchain.agents.initialize_agent(tools: Sequence[langchain.tools.base.BaseTool], llm: langchain.base_language.BaseLanguageModel, agent: Optional[langchain.agents... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-49 | langchain.agents.load_tools(tool_names: List[str], llm: Optional[langchain.base_language.BaseLanguageModel] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → List[langchain.tools.base.BaseTool][source]#
Load tool... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5adedfb1d4b5-50 | Tools
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on May 29, 2023. | https://python.langchain.com/en/latest/reference/modules/agents.html |
b4dd02e110ae-0 | .rst
.pdf
Experimental Modules
Contents
Autonomous Agents
Generative Agents
Experimental Modules#
This module contains experimental modules and reproductions of existing work using LangChain primitives.
Autonomous Agents#
Here, we document the BabyAGI and AutoGPT classes from the langchain.experimental module.
class ... | https://python.langchain.com/en/latest/reference/modules/experimental.html |
b4dd02e110ae-1 | Get the next task.
property input_keys: List[str]#
Input keys this chain expects.
property output_keys: List[str]#
Output keys this chain expects.
prioritize_tasks(this_task_id: int, objective: str) → List[Dict][source]#
Prioritize tasks.
class langchain.experimental.AutoGPT(ai_name: str, memory: langchain.vectorstores... | https://python.langchain.com/en/latest/reference/modules/experimental.html |
b4dd02e110ae-2 | Summary of the events in the plan that the agent took.
generate_dialogue_response(observation: str, now: Optional[datetime.datetime] = None) → Tuple[bool, str][source]#
React to a given observation.
generate_reaction(observation: str, now: Optional[datetime.datetime] = None) → Tuple[bool, str][source]#
React to a given... | https://python.langchain.com/en/latest/reference/modules/experimental.html |
b4dd02e110ae-3 | field traits: str = 'N/A'#
Permanent traits to ascribe to the character.
class langchain.experimental.GenerativeAgentMemory(*, llm: langchain.base_language.BaseLanguageModel, memory_retriever: langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever, verbose: bool = False, reflection_threshold: Opt... | https://python.langchain.com/en/latest/reference/modules/experimental.html |
b4dd02e110ae-4 | The core language model.
load_memory_variables(inputs: Dict[str, Any]) → Dict[str, str][source]#
Return key-value pairs given the text input to the chain.
field memory_retriever: langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever [Required]#
The retriever to fetch related memories.
property m... | https://python.langchain.com/en/latest/reference/modules/experimental.html |
9d02ad4292e8-0 | .rst
.pdf
Memory
Memory#
class langchain.memory.CassandraChatMessageHistory(contact_points: List[str], session_id: str, port: int = 9042, username: str = 'cassandra', password: str = 'cassandra', keyspace_name: str = 'chat_history', table_name: str = 'message_store')[source]#
Chat message history that stores history in... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-1 | clear() → None[source]#
Clear context from this session for every memory.
load_memory_variables(inputs: Dict[str, Any]) → Dict[str, str][source]#
Load all vars from sub-memories.
save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None[source]#
Save context from this session for every memory.
property memor... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-2 | field entity_extraction_prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['history', 'input'], output_parser=None, partial_variables={}, template='You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last l... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-3 | a lot of work! What kind of things are you doing to make Langchain better?"\nLast line:\nPerson #1: i\'m trying to improve Langchain\'s interfaces, the UX, its integrations with various products the user might want ... a lot of stuff.\nOutput: Langchain\nEND OF EXAMPLE\n\nEXAMPLE\nConversation history:\nPerson #1: how\... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-4 | field entity_store: langchain.memory.entity.BaseEntityStore [Optional]#
field entity_summarization_prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['entity', 'summary', 'history', 'input'], output_parser=None, partial_variables={}, template='You are an AI assistant helping a human kee... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-5 | Knowledge graph memory for storing conversation memory.
Integrates with external knowledge graph to store and retrieve
information about knowledge triples in the conversation.
field ai_prefix: str = 'AI'# | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-6 | field entity_extraction_prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['history', 'input'], output_parser=None, partial_variables={}, template='You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last l... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-7 | a lot of work! What kind of things are you doing to make Langchain better?"\nLast line:\nPerson #1: i\'m trying to improve Langchain\'s interfaces, the UX, its integrations with various products the user might want ... a lot of stuff.\nOutput: Langchain\nEND OF EXAMPLE\n\nEXAMPLE\nConversation history:\nPerson #1: how\... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-8 | field human_prefix: str = 'Human'#
field k: int = 2#
field kg: langchain.graphs.networkx_graph.NetworkxEntityGraph [Optional]# | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-9 | field knowledge_extraction_prompt: langchain.prompts.base.BasePromptTemplate = PromptTemplate(input_variables=['history', 'input'], output_parser=None, partial_variables={}, template="You are a networked intelligence helping a human track knowledge triples about all relevant people, things, concepts, etc. and integrati... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-10 | It's also the number 1 producer of gold in the US.\n\nOutput: (Nevada, is a, state)<|>(Nevada, is in, US)<|>(Nevada, is the number 1 producer of, gold)\nEND OF EXAMPLE\n\nEXAMPLE\nConversation history:\nPerson #1: Hello.\nAI: Hi! How are you?\nPerson #1: I'm good. How are you?\nAI: I'm good too.\nLast line of conversat... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-11 | huh. I know Descartes likes to drive antique scooters and play the mandolin.\nOutput: (Descartes, likes to drive, antique scooters)<|>(Descartes, plays, mandolin)\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for extraction):\nHuman: {input}\n\nOutput:", template_f... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-12 | field llm: langchain.base_language.BaseLanguageModel [Required]#
field summary_message_cls: Type[langchain.schema.BaseMessage] = <class 'langchain.schema.SystemMessage'>#
Number of previous utterances to include in the context.
clear() → None[source]#
Clear memory contents.
get_current_entities(input_string: str) → Lis... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-13 | field memory_key: str = 'history'#
field moving_summary_buffer: str = ''#
clear() → None[source]#
Clear memory contents.
load_memory_variables(inputs: Dict[str, Any]) → Dict[str, Any][source]#
Return history buffer.
prune() → None[source]#
Prune buffer if it exceeds max token limit
save_context(inputs: Dict[str, Any], ... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-14 | Save context from this conversation to buffer. Pruned.
property buffer: List[langchain.schema.BaseMessage]#
String buffer of memory.
class langchain.memory.CosmosDBChatMessageHistory(cosmos_endpoint: str, cosmos_database: str, cosmos_container: str, session_id: str, user_id: str, credential: Any = None, connection_stri... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-15 | class langchain.memory.FileChatMessageHistory(file_path: str)[source]#
Chat message history that stores history in a local file.
Parameters
file_path – path of the local file to store the messages.
add_message(message: langchain.schema.BaseMessage) → None[source]#
Append the message to the record in the local file
clea... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-16 | clear() → None[source]#
Remove the session’s messages from the cache.
Raises
SdkException – Momento service or network error.
Exception – Unexpected response.
classmethod from_client_params(session_id: str, cache_name: str, ttl: timedelta, *, configuration: Optional[momento.config.Configuration] = None, auth_token: Opt... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-17 | clear() → None[source]#
Clear session memory from PostgreSQL
property messages: List[langchain.schema.BaseMessage]#
Retrieve the messages from PostgreSQL
pydantic model langchain.memory.ReadOnlySharedMemory[source]#
A memory wrapper that is read-only and cannot be changed.
field memory: langchain.schema.BaseMemory [Req... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-18 | clear() → None[source]#
Delete all entities from store.
delete(key: str) → None[source]#
Delete entity value from store.
exists(key: str) → bool[source]#
Check if entity exists in store.
property full_key_prefix: str#
get(key: str, default: Optional[str] = None) → Optional[str][source]#
Get entity value from store.
key... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9d02ad4292e8-19 | Key name to locate the memories in the result of load_memory_variables.
field retriever: langchain.vectorstores.base.VectorStoreRetriever [Required]#
VectorStoreRetriever object to connect to.
field return_docs: bool = False#
Whether or not to return the result of querying the database directly.
clear() → None[source]#... | https://python.langchain.com/en/latest/reference/modules/memory.html |
9a8bbf5641e5-0 | .rst
.pdf
Tools
Tools#
Core toolkit implementations.
pydantic model langchain.tools.AIPluginTool[source]#
field api_spec: str [Required]#
field args_schema: Type[AIPluginToolSchema] = <class 'langchain.tools.plugin.AIPluginToolSchema'>#
Pydantic model class to validate and parse the tool’s input arguments.
field plugin... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-1 | to_typescript() → str[source]#
Get typescript string representation of the operation.
static ts_type_from_python(type_: Union[str, Type, tuple, None, enum.Enum]) → str[source]#
property body_params: List[str]#
property path_params: List[str]#
property query_params: List[str]#
pydantic model langchain.tools.AzureCogsFor... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-2 | pydantic model langchain.tools.BaseTool[source]#
Interface LangChain tools must implement.
field args_schema: Optional[Type[pydantic.main.BaseModel]] = None#
Pydantic model class to validate and parse the tool’s input arguments.
field callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None#
Depr... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-3 | Run the tool asynchronously.
run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → Any[s... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-4 | Timeout (in ms) for Playwright to wait for element to be ready.
field visible_only: bool = True#
Whether to consider only visible elements.
pydantic model langchain.tools.CopyFileTool[source]#
field args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.copy.FileCopyInput'>#
Pydantic model... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-5 | field name: str = 'file_delete'#
The unique name of the tool that clearly communicates its purpose.
pydantic model langchain.tools.DuckDuckGoSearchResults[source]#
Tool that queries the Duck Duck Go Search API and get back json.
field api_wrapper: langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper [Option... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-6 | Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
field name: str = 'extract_text'#
The unique name of the tool that clearly communicates its purpose.
pydantic model langchain.tools.FileSearchTool[source]#
field args_schema: Type[pydantic.main.BaseModel... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-7 | Pydantic model class to validate and parse the tool’s input arguments.
field description: str = 'Use this tool to create a draft email with the provided message fields.'#
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
field name: str = 'create_gmail_... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-8 | The unique name of the tool that clearly communicates its purpose.
pydantic model langchain.tools.GmailSearch[source]#
field args_schema: Type[langchain.tools.gmail.search.SearchArgsSchema] = <class 'langchain.tools.gmail.search.SearchArgsSchema'>#
Pydantic model class to validate and parse the tool’s input arguments.
... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-9 | Tool that adds the capability to query the Google search API.
field api_wrapper: langchain.utilities.google_search.GoogleSearchAPIWrapper [Required]#
pydantic model langchain.tools.GoogleSerperResults[source]#
Tool that has capability to query the Serper.dev Google Search API
and get back json.
field api_wrapper: langc... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-10 | You can provide few-shot examples as a part of the description.
field name: str = 'list_directory'#
The unique name of the tool that clearly communicates its purpose.
pydantic model langchain.tools.ListPowerBITool[source]#
Tool for getting tables names.
field powerbi: langchain.utilities.powerbi.PowerBIDataset [Require... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-11 | The unique name of the tool that clearly communicates its purpose.
pydantic model langchain.tools.NavigateTool[source]#
field args_schema: Type[BaseModel] = <class 'langchain.tools.playwright.navigate.NavigateToolInput'>#
Pydantic model class to validate and parse the tool’s input arguments.
field description: str = 'N... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-12 | Return a list of valid methods for the specified path.
get_operation(path: str, method: str) → openapi_schema_pydantic.v3.v3_1_0.operation.Operation[source]#
Get the operation object for a given path and HTTP method.
get_parameters_for_operation(operation: openapi_schema_pydantic.v3.v3_1_0.operation.Operation) → List[o... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-13 | Validators
raise_deprecation » all fields
validate_llm_chain_input_variables » llm_chain
field examples: Optional[str] = '\nQuestion: How many rows are in the table <table>?\nDAX: EVALUATE ROW("Number of rows", COUNTROWS(<table>))\n----\nQuestion: How many rows are in the table <table> where <column> is not empty?\nDAX... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-14 | field template: Optional[str] = '\nAnswer the question below with a DAX query that can be sent to Power BI. DAX queries have a simple syntax comprised of just one required keyword, EVALUATE, and several optional keywords: ORDER BY, START AT, DEFINE, MEASURE, VAR, TABLE, and COLUMN. Each keyword defines a statement used... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-15 | columns, expressions, and values. However, some functions, such as PI, do not require any arguments, but always require parentheses to indicate the null argument. For example, you must always type PI(), not PI. You can also nest functions within other functions. \n\nSome commonly used functions are:\nEVALUATE <table> -... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-16 | VAR; EVALUATE <table> - The optional DEFINE keyword introduces one or more calculated entity definitions that exist only for the duration of the query. Definitions precede the EVALUATE statement and are valid for all EVALUATE statements in the query. Definitions can be variables, measures, tables1, and columns1. Defini... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-17 | <filter> is a Boolean expression that is to be evaluated for each row of the table. For example, [Amount] > 0 or [Region] = "France"\nROW(<name>, <expression>) - Returns a table with a single row containing values that result from the expressions given to each column.\nDISTINCT(<column>) - Returns a one-column table th... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-18 | Functions names with an X in it can include a expression as an argument, this will be evaluated for each row in the table and the result will be used in the regular function calculation, these are the functions:\nCOUNT(<column>), COUNTA(<column>), COUNTX(<table>,<expression>), COUNTAX(<table>,<expression>), COUNTROWS([... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-19 | Returns a date value that represents the specified year, month, and day.\nDATEDIFF(date1, date2, <interval>) - Returns the difference between two date values, in the specified interval, that can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR.\nDATEVALUE(<date_text>) - Returns a date value that represents the ... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-20 | case you need to rewrite the DAX query to get the correct answer.\n\nThe following tables exist: {tables}\n\nand the schema\'s for some are given here:\n{schemas}\n\nExamples:\n{examples}\n\nQuestion: {tool_input}\nDAX: \n'# | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-21 | pydantic model langchain.tools.ReadFileTool[source]#
field args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.read.ReadFileInput'>#
Pydantic model class to validate and parse the tool’s input arguments.
field description: str = 'Read file from disk'#
Used to tell the model how/when/why... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-22 | The input arguments’ schema.
The tool schema.
field coroutine: Optional[Callable[[...], Awaitable[Any]]] = None#
The asynchronous version of the function.
field 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.
field func: Callabl... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-23 | The function to run when the tool is called.
field handle_tool_error: Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]] = False#
Handle the content of the ToolException thrown.
field name: str [Required]#
The unique name of the tool that clearly communicates its purpose.
field return_direc... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-24 | pydantic model langchain.tools.WriteFileTool[source]#
field args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.write.WriteFileInput'>#
Pydantic model class to validate and parse the tool’s input arguments.
field description: str = 'Write file to disk'#
Used to tell the model how/when/w... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-25 | your exposed actions here: https://nla.zapier.com/demo/start/
The return JSON is guaranteed to be less than ~500 words (350
tokens) making it safe to inject into the prompt of another LLM
call.
Parameters
action_id – a specific action ID (from list actions) of the action to execute
(the set api_key must be associated w... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-26 | field api_wrapper: langchain.utilities.zapier.ZapierNLAWrapper [Optional]#
field base_prompt: str = 'A wrapper around Zapier NLA actions. The input to this tool is a natural language instruction, for example "get the latest email from my bank" or "send a slack message to the #general channel". Each tool will have param... | https://python.langchain.com/en/latest/reference/modules/tools.html |
9a8bbf5641e5-27 | than continuing the agent loop.
args_schema – optional argument schema for user to specify
infer_schema – Whether to infer the schema of the arguments from
the function’s signature. This also makes the resultant tool
accept a dictionary input to its run() function.
Requires:
Function must be of type (str) -> str
Functi... | https://python.langchain.com/en/latest/reference/modules/tools.html |
0f266f3a9bfa-0 | .rst
.pdf
SerpAPI
SerpAPI#
For backwards compatiblity.
pydantic model langchain.serpapi.SerpAPIWrapper[source]#
Wrapper around SerpAPI.
To use, you should have the google-search-results python package installed,
and the environment variable SERPAPI_API_KEY set with your API key, or pass
serpapi_api_key as a named param... | https://python.langchain.com/en/latest/reference/modules/serpapi.html |
e8f04845209a-0 | .rst
.pdf
Agent Toolkits
Agent Toolkits#
Agent toolkits.
pydantic model langchain.agents.agent_toolkits.AzureCognitiveServicesToolkit[source]#
Toolkit for Azure Cognitive Services.
get_tools() → List[langchain.tools.base.BaseTool][source]#
Get the tools in the toolkit.
pydantic model langchain.agents.agent_toolkits.Fil... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
e8f04845209a-1 | get_tools() → List[langchain.tools.base.BaseTool][source]#
Get the tools in the toolkit.
pydantic model langchain.agents.agent_toolkits.NLAToolkit[source]#
Natural Language API Toolkit Definition.
field nla_tools: Sequence[langchain.agents.agent_toolkits.nla.tool.NLATool] [Required]#
List of API Endpoint Tools.
classme... | https://python.langchain.com/en/latest/reference/modules/agent_toolkits.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.