id stringlengths 14 15 | text stringlengths 27 2.12k | source stringlengths 49 118 |
|---|---|---|
d9c61ea199c9-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksAsync callbacksCustom callback handlersCallbacks for custom chainsLogging to fileMultiple callback handlersTagsToken coun... | https://python.langchain.com/docs/modules/callbacks/ |
d9c61ea199c9-2 | Any) -> Any: """Run on new LLM token. Only available when streaming is enabled.""" def on_llm_end(self, response: LLMResult, **kwargs: Any) -> Any: """Run when LLM ends running.""" def on_llm_error( self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any ) -> Any: """Run whe... | https://python.langchain.com/docs/modules/callbacks/ |
d9c61ea199c9-3 | ) -> Any: """Run when tool errors.""" def on_text(self, text: str, **kwargs: Any) -> Any: """Run on arbitrary text.""" def on_agent_action(self, action: AgentAction, **kwargs: Any) -> Any: """Run on agent action.""" def on_agent_finish(self, finish: AgentFinish, **kwargs: Any) -> Any: ... | https://python.langchain.com/docs/modules/callbacks/ |
d9c61ea199c9-4 | callbacks=[handler]) > Entering new LLMChain chain... Prompt after formatting: 1 + 2 = > Finished chain. > Entering new LLMChain chain... Prompt after formatting: 1 + 2 = > Finished chain. > Entering new LLMChain chain... Prompt after formatting: 1 + 2 = ... | https://python.langchain.com/docs/modules/callbacks/ |
d9c61ea199c9-5 | that object and all child objects. This is useful for debugging, as it will log all events to the console.When do you want to use each of these?​Constructor callbacks are most useful for use cases such as logging, monitoring, etc., which are not specific to a single request, but rather to the entire chain. For exampl... | https://python.langchain.com/docs/modules/callbacks/ |
16f76cc54dc2-0 | Async callbacks | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/callbacks/async_callbacks |
16f76cc54dc2-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksAsync callbacksCustom callback handlersCallbacks for custom chainsLogging to fileMultiple callback handlersTagsToken coun... | https://python.langchain.com/docs/modules/callbacks/async_callbacks |
16f76cc54dc2-2 | class_name = serialized["name"] print("Hi! I just woke up. Your llm is starting") async def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None: """Run when chain ends running.""" print("zzzz....") await asyncio.sleep(0.3) print("Hi! I just woke up. Your llm is ending")# T... | https://python.langchain.com/docs/modules/callbacks/async_callbacks |
16f76cc54dc2-3 | token: Sync handler being called in a `thread_pool_executor`: token: Because Sync handler being called in a `thread_pool_executor`: token: they Sync handler being called in a `thread_pool_executor`: token: make Sync handler being called in a `thread_pool_executor`: token: up Sync handler bei... | https://python.langchain.com/docs/modules/callbacks/async_callbacks |
cb318fa81f90-0 | Multiple callback handlers | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/callbacks/multiple_callbacks |
cb318fa81f90-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksAsync callbacksCustom callback handlersCallbacks for custom chainsLogging to fileMultiple callback handlersTagsToken coun... | https://python.langchain.com/docs/modules/callbacks/multiple_callbacks |
cb318fa81f90-2 | token: str, **kwargs: Any) -> Any: print(f"on_new_token {token}") def on_llm_error( self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any ) -> Any: """Run when LLM errors.""" def on_chain_start( self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any ) -... | https://python.langchain.com/docs/modules/callbacks/multiple_callbacks |
cb318fa81f90-3 | llm=llm)agent = initialize_agent(tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION)# Callbacks for handler1 will be issued by every object involved in the# Agent execution (llm, llmchain, tool, agent executor)agent.run("What is 2 raised to the 0.235 power?", callbacks=[handler1]) on_chain_start AgentExecutor ... | https://python.langchain.com/docs/modules/callbacks/multiple_callbacks |
cb318fa81f90-4 | on_llm_start (I'm the second handler!!) OpenAI on_new_token on_new_token ```text on_new_token on_new_token 2 on_new_token ** on_new_token 0 on_new_token . on_new_token 235 on_new_token on_new_token ``` on_new_token ... on_new_token num on_new_token expr on_new_to... | https://python.langchain.com/docs/modules/callbacks/multiple_callbacks |
cb318fa81f90-5 | on_new_token 187 on_new_token 674 on_new_token '1.1769067372187674'PreviousLogging to fileNextTagsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc. | https://python.langchain.com/docs/modules/callbacks/multiple_callbacks |
e295408dcdd0-0 | Tags | 🦜�🔗 Langchain
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksAsync callbacksCustom callback handlersCallbacks for custom chainsLogging to fileMultip... | https://python.langchain.com/docs/modules/callbacks/tags |
fd769657d6f1-0 | Logging to file | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/callbacks/filecallbackhandler |
fd769657d6f1-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksAsync callbacksCustom callback handlersCallbacks for custom chainsLogging to fileMultiple callback handlersTagsToken coun... | https://python.langchain.com/docs/modules/callbacks/filecallbackhandler |
fd769657d6f1-2 | | [1mINFO [0m | [36m__main__[0m:[36m<module>[0m:[36m20[0m - [1m 3[0m > Finished chain.Now we can open the file output.log to see that the output has been captured.pip install ansi2html > /dev/nullfrom IPython.display import display, HTMLfrom ansi2html import Ansi2HTMLConverterwith open("outpu... | https://python.langchain.com/docs/modules/callbacks/filecallbackhandler |
fd769657d6f1-3 | class="ansi1 ansi32"></span><span class="ansi1 ansi3 ansi32">1 + 2 = </span><span class="ansi1">> Finished chain.</span><span class="ansi32">2023-06-01 18:36:38.929</span> | <span class="ansi1">INFO </span> | <span class="ansi36">__main__</span>:<span class="ansi36"><module></span>:<span class="ansi36">20</... | https://python.langchain.com/docs/modules/callbacks/filecallbackhandler |
6c72766d35a3-0 | Custom callback handlers | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/callbacks/custom_callbacks |
6c72766d35a3-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksAsync callbacksCustom callback handlersCallbacks for custom chainsLogging to fileMultiple callback handlersTagsToken coun... | https://python.langchain.com/docs/modules/callbacks/custom_callbacks |
6c72766d35a3-2 | My custom handler, token: make My custom handler, token: up My custom handler, token: everything My custom handler, token: . My custom handler, token: AIMessage(content="Why don't scientists trust atoms? \n\nBecause they make up everything.", additional_kwargs={}, example=False)PreviousAsync callback... | https://python.langchain.com/docs/modules/callbacks/custom_callbacks |
2d8c126b9d09-0 | Token counting | 🦜�🔗 Langchain
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksAsync callbacksCustom callback handlersCallbacks for custom chainsLogging to ... | https://python.langchain.com/docs/modules/callbacks/token_counting |
1ac406534d3e-0 | Callbacks for custom chains | 🦜�🔗 Langchain
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksAsync callbacksCustom callback handlersCallbacks for custom chai... | https://python.langchain.com/docs/modules/callbacks/custom_chain |
954348521533-0 | Evaluation | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/evaluation/ |
954348521533-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsExamplesDebuggingDeploymentLangSmithMod... | https://python.langchain.com/docs/modules/evaluation/ |
954348521533-2 | extensible API so you can create your own or contribute improvements for everyone to use. The following sections have example notebooks for you to get started.String Evaluators: Evaluate the predicted string for a given input, usually against a reference stringTrajectory Evaluators: Evaluate the whole trajectory of age... | https://python.langchain.com/docs/modules/evaluation/ |
abfe4f763c81-0 | Comparison Evaluators | 🦜�🔗 Langchain
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsCustom Pa... | https://python.langchain.com/docs/modules/evaluation/comparison/ |
230dcbd468c9-0 | Comparing Chain Outputs | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/evaluation/examples/comparisons |
230dcbd468c9-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsExamplesAgent VectorDB Question Answeri... | https://python.langchain.com/docs/modules/evaluation/examples/comparisons |
230dcbd468c9-2 | provide more reliable results. We will use some example queries someone might have about how to use langchain here.from langchain.evaluation.loading import load_datasetdataset = load_dataset("langchain-howto-queries") Found cached dataset parquet (/Users/wfh/.cache/huggingface/datasets/LangChainDatasets___parquet/La... | https://python.langchain.com/docs/modules/evaluation/examples/comparisons |
230dcbd468c9-3 | when you need to answer questions about current events. You should ask targeted questions.", ),]functions_agent = initialize_agent( tools, llm, agent=AgentType.OPENAI_MULTI_FUNCTIONS, verbose=False)conversations_agent = initialize_agent( tools, llm, agent=AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION, verbose=Fal... | https://python.langchain.com/docs/modules/evaluation/examples/comparisons |
230dcbd468c9-4 | Retrying langchain.chat_models.openai.acompletion_with_retry.<locals>._completion_with_retry in 1.0 seconds as it raised ServiceUnavailableError: The server is overloaded or not ready yet..Step 5. Evaluate Pairs​Now it's time to evaluate the results. For each agent response, run the evaluation chain to select which o... | https://python.langchain.com/docs/modules/evaluation/examples/comparisons |
230dcbd468c9-5 | ) if eval_res["value"] == "A": preferences.append(a) elif eval_res["value"] == "B": preferences.append(b) else: preferences.append(None) # No preference return preferencespreferences = predict_preferences(dataset, results)Print out the ratio of preferences.from ... | https://python.langchain.com/docs/modules/evaluation/examples/comparisons |
230dcbd468c9-6 | not be used. """ total_preferences = preferences.count("a") + preferences.count("b") n_s = preferences.count(which) if total_preferences == 0: return (0, 0) p_hat = n_s / total_preferences denominator = 1 + (z**2) / total_preferences adjustment = (z / denominator) * sqrt( p_hat * (1 -... | https://python.langchain.com/docs/modules/evaluation/examples/comparisons |
230dcbd468c9-7 | import statspreferred_model = max(pref_ratios, key=pref_ratios.get)successes = preferences.count(preferred_model)n = len(preferences) - preferences.count(None)p_value = stats.binom_test(successes, n, p=0.5, alternative="two-sided")print( f"""The p-value is {p_value:.5f}. If the null hypothesis is true (i.e., if the ... | https://python.langchain.com/docs/modules/evaluation/examples/comparisons |
437075051fc2-0 | Trajectory Evaluators | 🦜�🔗 Langchain
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajector... | https://python.langchain.com/docs/modules/evaluation/trajectory/ |
1db58d4bca7c-0 | String Evaluators | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/evaluation/string/ |
1db58d4bca7c-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsEvaluating Custom CriteriaCustom String EvaluatorEmbedding DistanceQA Correctness... | https://python.langchain.com/docs/modules/evaluation/string/ |
1db58d4bca7c-2 | used alongside approximate/fuzzy matching criteria for very basic unit testing.PreviousEvaluationNextEvaluating Custom CriteriaCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc. | https://python.langchain.com/docs/modules/evaluation/string/ |
cfa9f91940ff-0 | Memory | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/ |
cfa9f91940ff-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/ |
cfa9f91940ff-2 | Secondly, LangChain provides easy ways to incorporate these utilities into chains.Get started​Memory involves keeping a concept of state around throughout a user's interactions with an language model. A user's interactions with a language model are captured in the concept of ChatMessages, so this boils down to ingest... | https://python.langchain.com/docs/modules/memory/ |
cfa9f91940ff-3 | now show how to use this simple concept in a chain. We first showcase ConversationBufferMemory which is just a wrapper around ChatMessageHistory that extracts the messages in a variable.We can first extract it as a string.from langchain.memory import ConversationBufferMemorymemory = ConversationBufferMemory()memory.cha... | https://python.langchain.com/docs/modules/memory/ |
cfa9f91940ff-4 | It's nice to meet you. How can I help you today?"conversation.predict(input="I'm doing well! Just having a conversation with an AI.") > Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of s... | https://python.langchain.com/docs/modules/memory/ |
cfa9f91940ff-5 | Finished chain. " Sure! I'm an AI created to help people with their everyday tasks. I'm programmed to understand natural language and provide helpful information. I'm also constantly learning and updating my knowledge base so I can provide more accurate and helpful answers."Saving Message History​You may often hav... | https://python.langchain.com/docs/modules/memory/ |
f7cf51665ac6-0 | Conversation buffer window memory | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/buffer_window |
f7cf51665ac6-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/buffer_window |
f7cf51665ac6-2 | {'history': [HumanMessage(content='not much you', additional_kwargs={}), AIMessage(content='not much', additional_kwargs={})]}Using in a chain​Let's walk through an example, again setting verbose=True so we can see the prompt.from langchain.llms import OpenAIfrom langchain.chains import ConversationChainconversa... | https://python.langchain.com/docs/modules/memory/buffer_window |
f7cf51665ac6-3 | it truthfully says it does not know. Current conversation: Human: Hi, what's up? AI: Hi there! I'm doing great. I'm currently helping a customer with a technical issue. How about you? Human: What's their issues? AI: > Finished chain. " The customer is having trouble connecting to their Wi-... | https://python.langchain.com/docs/modules/memory/buffer_window |
f7cf51665ac6-4 | > Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know. Current c... | https://python.langchain.com/docs/modules/memory/buffer_window |
0e75069727de-0 | Conversation buffer memory | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/buffer |
0e75069727de-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/buffer |
0e75069727de-2 | langchain.chains import ConversationChainllm = OpenAI(temperature=0)conversation = ConversationChain( llm=llm, verbose=True, memory=ConversationBufferMemory())conversation.predict(input="Hi there!") > Entering new ConversationChain chain... Prompt after formatting: The following is a friendl... | https://python.langchain.com/docs/modules/memory/buffer |
0e75069727de-3 | new. What would you like to talk about?"conversation.predict(input="Tell me about yourself.") > Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context... | https://python.langchain.com/docs/modules/memory/buffer |
76c32b6ea2bd-0 | How to add Memory to an LLMChain | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/adding_memory |
76c32b6ea2bd-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/adding_memory |
76c32b6ea2bd-2 | prompt=prompt, verbose=True, memory=memory,)llm_chain.predict(human_input="Hi there my friend") > Entering new LLMChain chain... Prompt after formatting: You are a chatbot having a conversation with a human. Human: Hi there my friend Chatbot: > Finished LLMChain chain. ' H... | https://python.langchain.com/docs/modules/memory/adding_memory |
d34a8e08aec7-0 | How to create a custom Memory class | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/custom_memory |
d34a8e08aec7-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/custom_memory |
d34a8e08aec7-2 | spacy# !python -m spacy download en_core_web_lgimport spacynlp = spacy.load("en_core_web_lg")class SpacyEntityMemory(BaseMemory, BaseModel): """Memory class for storing information about entities.""" # Define dictionary to store information about entities. entities: dict = {} # Define key to pass informatio... | https://python.langchain.com/docs/modules/memory/custom_memory |
d34a8e08aec7-3 | to buffer.""" # Get the input text and run through spacy text = inputs[list(inputs.keys())[0]] doc = nlp(text) # For each entity that was mentioned, save this information to the dictionary. for ent in doc.ents: ent_str = str(ent) if ent_str in self.entities: ... | https://python.langchain.com/docs/modules/memory/custom_memory |
d34a8e08aec7-4 | likes machine learning") > Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully say... | https://python.langchain.com/docs/modules/memory/custom_memory |
d34a8e08aec7-5 | ' From what I know about Harrison, I believe his favorite subject in college was machine learning. He has expressed a strong interest in the subject and has mentioned it often.'Again, please note that this implementation is pretty simple and brittle and probably not useful in a production setting. Its purpose is to sho... | https://python.langchain.com/docs/modules/memory/custom_memory |
8deb7146be70-0 | How to add memory to a Multi-Input Chain | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/adding_memory_chain_multiple_inputs |
8deb7146be70-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/adding_memory_chain_multiple_inputs |
8deb7146be70-2 | i} for i in range(len(texts))]) Running Chroma using direct local API. Using DuckDB in-memory for database. Data will be transient.query = "What did the president say about Justice Breyer"docs = docsearch.similarity_search(query)from langchain.chains.question_answering import load_qa_chainfrom langchain.llms impo... | https://python.langchain.com/docs/modules/memory/adding_memory_chain_multiple_inputs |
8deb7146be70-3 | and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service.PreviousHow to add Memory to an LLMChainNextHow to add Memory to an AgentCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc. | https://python.langchain.com/docs/modules/memory/adding_memory_chain_multiple_inputs |
577811684829-0 | Adding Message Memory backed by a database to an Agent | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
577811684829-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
577811684829-2 | langchain import OpenAI, LLMChainfrom langchain.utilities import GoogleSearchAPIWrappersearch = GoogleSearchAPIWrapper()tools = [ Tool( name="Search", func=search.run, description="useful for when you need to answer questions about current events", )]Notice the usage of the chat_history varia... | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
577811684829-3 | new AgentExecutor chain... Thought: I need to find out the population of Canada Action: Search Action Input: Population of Canada Observation: The current population of Canada is 38,566,192 as of Saturday, December 31, 2022, based on Worldometer elaboration of the latest United Nations data. · Canada ... ... | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
577811684829-4 | Thought: I now know the final answer Final Answer: The current population of Canada is 38,566,192 as of Saturday, December 31, 2022, based on Worldometer elaboration of the latest United Nations data. > Finished AgentExecutor chain. 'The current population of Canada is 38,566,192 as of Saturday, December 31, 2... | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
577811684829-5 | Canada) is the national anthem of Canada. The song was originally commissioned by Lieutenant Governor of Quebec Théodore Robitaille ... Feb 1, 2018 ... It was a simple tweak — just two words. But with that, Canada just voted to make its national anthem, “O Canada,� gender neutral, ... "O Canada" was proclaimed... | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
577811684829-6 | tools, prefix=prefix, suffix=suffix, input_variables=["input", "agent_scratchpad"])llm_chain = LLMChain(llm=OpenAI(temperature=0), prompt=prompt)agent = ZeroShotAgent(llm_chain=llm_chain, tools=tools, verbose=True)agent_without_memory = AgentExecutor.from_agent_and_tools( agent=agent, tools=tools, verbose=True)agent... | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
577811684829-7 | from ... Population. • Q4 2022 estimate. 39,292,355 (37th). Information is available for the total Indigenous population and each of the three ... The term 'Aboriginal' or 'Indigenous' used on the Statistics Canada ... Jun 14, 2022 ... Determinants of health are the broad range of personal, social, economic and envi... | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
577811684829-8 | Hayrenik" (Our Fatherland) · 3. Azerbaijan (a transcontinental country with ... A national anthem is a patriotic musical composition symbolizing and evoking eulogies of the history and traditions of a country or nation. National Anthem of Every Country ; Fiji, “Meda Dau Doka� (“God Bless Fiji�) ; Finland, “... | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
577811684829-9 | national anthem of [country] is [name of anthem].'PreviousHow to add Memory to an AgentNextConversation buffer memoryCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc. | https://python.langchain.com/docs/modules/memory/agent_with_memory_in_db |
f86f8442616e-0 | ConversationTokenBufferMemory | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/token_buffer |
f86f8442616e-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/token_buffer |
f86f8442616e-2 | "not much you"}, {"output": "not much"})Using in a chain​Let's walk through an example, again setting verbose=True so we can see the prompt.from langchain.chains import ConversationChainconversation_with_summary = ConversationChain( llm=llm, # We set a very low max_token_limit for the purposes of testing. me... | https://python.langchain.com/docs/modules/memory/token_buffer |
f86f8442616e-3 | I'm doing great, just enjoying the day. How about you? Human: Just working on writing some documentation! AI: > Finished chain. ' Sounds like a productive day! What kind of documentation are you writing?'conversation_with_summary.predict(input="For LangChain! Have you heard of it?") > Enterin... | https://python.langchain.com/docs/modules/memory/token_buffer |
f86f8442616e-4 | is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know. Current conversation: Human: For LangChain! Have you heard of it? AI: Yes, I have heard of LangChain! It is a decentralized language-learning platform... | https://python.langchain.com/docs/modules/memory/token_buffer |
a4d593908c86-0 | How to use multiple memory classes in the same chain | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/multiple_memory |
a4d593908c86-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/multiple_memory |
a4d593908c86-2 | = PromptTemplate( input_variables=["history", "input", "chat_history_lines"], template=_DEFAULT_TEMPLATE,)llm = OpenAI(temperature=0)conversation = ConversationChain(llm=llm, verbose=True, memory=memory, prompt=PROMPT)conversation.run("Hi!") > Entering new ConversationChain chain... Prompt after for... | https://python.langchain.com/docs/modules/memory/multiple_memory |
a4d593908c86-3 | > Finished chain. ' Sure! What did the fish say when it hit the wall?\nHuman: I don\'t know.\nAI: "Dam!"'PreviousConversation Knowledge Graph MemoryNextConversation summary memoryCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc. | https://python.langchain.com/docs/modules/memory/multiple_memory |
5947d9d4a820-0 | ConversationSummaryBufferMemory | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/summary_buffer |
5947d9d4a820-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/summary_buffer |
5947d9d4a820-2 | a chat model).memory = ConversationSummaryBufferMemory( llm=llm, max_token_limit=10, return_messages=True)memory.save_context({"input": "hi"}, {"output": "whats up"})memory.save_context({"input": "not much you"}, {"output": "not much"})We can also utilize the predict_new_summary method directly.messages = memory.cha... | https://python.langchain.com/docs/modules/memory/summary_buffer |
5947d9d4a820-3 | > Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know. Current c... | https://python.langchain.com/docs/modules/memory/summary_buffer |
5947d9d4a820-4 | Have you heard of it? AI: > Finished chain. " No, I haven't heard of LangChain. Can you tell me more about it?"# We can see here that the summary and the buffer are updatedconversation_with_summary.predict( input="Haha nope, although a lot of people confuse it for that") > Entering new Conver... | https://python.langchain.com/docs/modules/memory/summary_buffer |
c48c28f40322-0 | Conversation summary memory | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/summary |
c48c28f40322-1 | Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d... | https://python.langchain.com/docs/modules/memory/summary |
c48c28f40322-2 | Conversation summary memory summarizes the conversation as it happens and stores the current summary in memory. This memory can then be used to inject the summary of the conversation so far into a prompt/chain. This memory is most useful for longer conversations, where keeping the past message history in the prompt ver... | https://python.langchain.com/docs/modules/memory/summary |
c48c28f40322-3 | '\nThe human greets the AI, to which the AI responds with a friendly greeting.'Using in a chain​Let's walk through an example of using this in a chain, again setting verbose=True so we can see the prompt.from langchain.llms import OpenAIfrom langchain.chains import ConversationChainllm = OpenAI(temperature=0)conversa... | https://python.langchain.com/docs/modules/memory/summary |
c48c28f40322-4 | The human greeted the AI and asked how it was doing. The AI replied that it was doing great and was currently helping a customer with a technical issue. Human: Tell me more about it! AI: > Finished chain. " Sure! The customer is having trouble with their computer not connecting to the internet. I'm help... | https://python.langchain.com/docs/modules/memory/summary |
c48c28f40322-5 | exploring different possibilities and have already tried resetting the router and checking the network settings, but the issue still persists."PreviousHow to use multiple memory classes in the same chainNextConversationSummaryBufferMemoryCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChai... | https://python.langchain.com/docs/modules/memory/summary |
4e582ca2c9de-0 | Vector store-backed memory | 🦜�🔗 Langchain | https://python.langchain.com/docs/modules/memory/vectorstore_retriever_memory |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.