id stringlengths 14 16 | text stringlengths 31 2.41k | source stringlengths 54 121 |
|---|---|---|
ffe6a87f4f10-0 | Modelsο
LangChain provides interfaces and integrations for a number of different types of models.
LLMs
Chat Models | https://api.python.langchain.com/en/latest/models.html |
570abd027f9e-0 | Model I/Oο
LangChain provides interfaces and integrations for working with language models.
Prompts
Models
Output Parsers | https://api.python.langchain.com/en/latest/model_io.html |
9d241ef1116b-0 | Promptsο
The reference guides here all relate to objects for working with Prompts.
Prompt Templates
Example Selector | https://api.python.langchain.com/en/latest/prompts.html |
98f977de8f2f-0 | Data connectionο
LangChain has a number of modules that help you load, structure, store, and retrieve documents.
Document Loaders
Document Transformers
Embeddings
Vector Stores
Retrievers | https://api.python.langchain.com/en/latest/data_connection.html |
f0bec661129a-0 | Embeddingsο
Wrappers around embedding modules.
class langchain.embeddings.OpenAIEmbeddings(*, client=None, model='text-embedding-ada-002', deployment='text-embedding-ada-002', openai_api_version=None, openai_api_base=None, openai_api_type=None, openai_proxy=None, embedding_ctx_length=8191, openai_api_key=None, openai_o... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-1 | from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings(
deployment="your-embeddings-deployment-name",
model="your-embeddings-model-name",
openai_api_base="https://your-endpoint.openai.azure.com/",
openai_api_type="azure",
)
text = "This is a test query."
query_result = em... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-2 | The model name to pass to tiktoken when using this class.
Tiktoken is used to count the number of tokens in documents to constrain
them to be under a certain limit. By default, when set to None, this will
be the same as the embedding model name. However, there are some cases
where you may want to use this Embedding cla... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-3 | Return type
List[List[float]]
embed_query(text)[source]ο
Call out to OpenAIβs embedding endpoint for embedding query text.
Parameters
text (str) β The text to embed.
Returns
Embedding for the text.
Return type
List[float]
class langchain.embeddings.HuggingFaceEmbeddings(*, client=None, model_name='sentence-transformers... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-4 | Model name to use.
embed_documents(texts)[source]ο
Compute doc embeddings using a HuggingFace transformer model.
Parameters
texts (List[str]) β The list of texts to embed.
Returns
List of embeddings, one for each text.
Return type
List[List[float]]
embed_query(text)[source]ο
Compute query embeddings using a HuggingFace... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-5 | Parameters
texts (List[str]) β The list of texts to embed.
Returns
List of embeddings, one for each text.
Return type
List[List[float]]
embed_query(text)[source]ο
Call out to Cohereβs embedding endpoint.
Parameters
text (str) β The text to embed.
Returns
Embeddings for the text.
Return type
List[float]
class langchain.... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-6 | es_password (Optional[str]) β (str, optional): Elasticsearch password.
Return type
langchain.embeddings.elasticsearch.ElasticsearchEmbeddings
Example
from langchain.embeddings import ElasticsearchEmbeddings
# Define the model ID and input field name (if different from default)
model_id = "your_model_id"
# Optional, onl... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-7 | Example
from elasticsearch import Elasticsearch
from langchain.embeddings import ElasticsearchEmbeddings
# Define the model ID and input field name (if different from default)
model_id = "your_model_id"
# Optional, only if different from 'text_field'
input_field = "your_input_field"
# Create Elasticsearch connection
es... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-8 | Bases: pydantic.main.BaseModel, langchain.embeddings.base.Embeddings
Wrapper around llama.cpp embedding models.
To use, you should have the llama-cpp-python library installed, and provide the
path to the Llama model as a named parameter to the constructor.
Check out: https://github.com/abetlen/llama-cpp-python
Example
... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-9 | Number of threads to use. If None, the number
of threads is automatically determined.
attribute seed: int = -1ο
Seed. If -1, a random seed is used.
attribute use_mlock: bool = Falseο
Force system to keep model in RAM.
attribute vocab_only: bool = Falseο
Only load the vocabulary, no weights.
embed_documents(texts)[sourc... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-10 | )
Parameters
client (Any) β
repo_id (str) β
task (Optional[str]) β
model_kwargs (Optional[dict]) β
huggingfacehub_api_token (Optional[str]) β
Return type
None
attribute model_kwargs: Optional[dict] = Noneο
Key word arguments to pass to the model.
attribute repo_id: str = 'sentence-transformers/all-mpnet-base-v2'ο
... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-11 | embed (Any) β
model_id (str) β
Return type
None
attribute model_id: str = 'damo/nlp_corom_sentence-embedding_english-base'ο
Model name to use.
embed_documents(texts)[source]ο
Compute doc embeddings using a modelscope embedding model.
Parameters
texts (List[str]) β The list of texts to embed.
Returns
List of embedding... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-12 | Returns
List of embeddings, one for each text.
Return type
List[List[float]]
embed_query(text)[source]ο
Compute query embeddings using a TensorflowHub embedding model.
Parameters
text (str) β The text to embed.
Returns
Embeddings for the text.
Return type
List[float]
class langchain.embeddings.SagemakerEndpointEmbeddin... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-13 | The content handler class that provides an input and
output transform functions to handle formats between LLM
and the endpoint.
attribute credentials_profile_name: Optional[str] = Noneο
The name of the profile in the ~/.aws/credentials or ~/.aws/config files, which
has either access keys or role information specified.
... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-14 | Parameters
text (str) β The text to embed.
Returns
Embeddings for the text.
Return type
List[float]
class langchain.embeddings.HuggingFaceInstructEmbeddings(*, client=None, model_name='hkunlp/instructor-large', cache_folder=None, model_kwargs=None, encode_kwargs=None, embed_instruction='Represent the document for retri... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-15 | attribute model_kwargs: Dict[str, Any] [Optional]ο
Key word arguments to pass to the model.
attribute model_name: str = 'hkunlp/instructor-large'ο
Model name to use.
attribute query_instruction: str = 'Represent the question for retrieving supporting documents: 'ο
Instruction to use for embedding query.
embed_documents... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-16 | endpoint_url=endpoint_url,
mosaicml_api_token="my-api-key"
)
Parameters
endpoint_url (str) β
embed_instruction (str) β
query_instruction (str) β
retry_sleep (float) β
mosaicml_api_token (Optional[str]) β
Return type
None
attribute embed_instruction: str = 'Represent the document for retrieval: 'ο
Instruction u... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-17 | Runs custom embedding models on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, as well as servers specified
by IP address and SSH credentials (such as on-prem, or another
cloud like Paperspace, Coreweave, etc.).
To use, you should have the runhouse pytho... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-18 | )
Parameters
cache (Optional[bool]) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
tags (Optional[List[str]]) β
pipeline_ref (Any) β
clien... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-19 | Returns
Embeddings for the text.
Return type
List[float]
class langchain.embeddings.SelfHostedHuggingFaceEmbeddings(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, pipeline_ref=None, client=None, inference_fn=<function _embed_documents>, hardware=None, model_load_fn=<function load_embeddi... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-20 | inference_fn (Callable) β
hardware (Any) β
model_load_fn (Callable) β
load_fn_kwargs (Optional[dict]) β
model_reqs (List[str]) β
inference_kwargs (Any) β
model_id (str) β
Return type
None
attribute hardware: Any = Noneο
Remote hardware to send the inference function to.
attribute inference_fn: Callable = <functi... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-21 | Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, as well as servers specified
by IP address and SSH credentials (such as on-prem, or another
cloud like Paperspace, Coreweave, etc.).
To use, you should have the runhouse python package installed.
Example
from langchain.embeddings import... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-22 | Requirements to install on hardware to inference the model.
attribute query_instruction: str = 'Represent the question for retrieving supporting documents: 'ο
Instruction to use for embedding query.
embed_documents(texts)[source]ο
Compute doc embeddings using a HuggingFace instruct model.
Parameters
texts (List[str]) β... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-23 | the query for a document as similar as possible.
To learn more, check out: https://docs.aleph-alpha.com/docs/tasks/semantic_embed/
Example
from aleph_alpha import AlephAlphaAsymmetricSemanticEmbedding
embeddings = AlephAlphaSymmetricSemanticEmbedding()
document = "This is a content of the document"
query = "What is the... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-24 | attribute normalize: Optional[bool] = Trueο
Should returned embeddings be normalized
embed_documents(texts)[source]ο
Call out to Aleph Alphaβs asymmetric Document endpoint.
Parameters
texts (List[str]) β The list of texts to embed.
Returns
List of embeddings, one for each text.
Return type
List[List[float]]
embed_query... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-25 | aleph_alpha_api_key (Optional[str]) β
Return type
None
embed_documents(texts)[source]ο
Call out to Aleph Alphaβs Document endpoint.
Parameters
texts (List[str]) β The list of texts to embed.
Returns
List of embeddings, one for each text.
Return type
List[List[float]]
embed_query(text)[source]ο
Call out to Aleph Alphaβ... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-26 | embed_type_query (str) β
minimax_group_id (Optional[str]) β
minimax_api_key (Optional[str]) β
Return type
None
attribute embed_type_db: str = 'db'ο
For embed_documents
attribute embed_type_query: str = 'query'ο
For embed_query
attribute endpoint_url: str = 'https://api.minimax.chat/v1/embeddings'ο
Endpoint URL to us... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-27 | If a specific credential profile should be used, you must pass
the name of the profile from the ~/.aws/credentials file that is to be used.
Make sure the credentials / roles used have the required policies to
access the Bedrock service.
Parameters
client (Any) β
region_name (Optional[str]) β
credentials_profile_name ... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-28 | only for compatibility with the embeddings interface.
Returns
List of embeddings, one for each text.
Return type
List[List[float]]
embed_query(text)[source]ο
Compute query embeddings using a Bedrock model.
Parameters
text (str) β The text to embed.
Returns
Embeddings for the text.
Return type
List[float]
class langchai... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-29 | deepinfra_api_token (Optional[str]) β
Return type
None
attribute embed_instruction: str = 'passage: 'ο
Instruction used to embed documents.
attribute model_id: str = 'sentence-transformers/clip-ViT-B-32'ο
Embeddings model to use.
attribute model_kwargs: Optional[dict] = Noneο
Other model keyword args
attribute normali... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-30 | os.environ["DASHSCOPE_API_KEY"] = "your DashScope API KEY"
from langchain.embeddings.dashscope import DashScopeEmbeddings
embeddings = DashScopeEmbeddings(
model="text-embedding-v1",
)
text = "This is a test query."
query_result = embeddings.embed_query(text)
Parameters
client (Any) β
model (str) β
dashscope_api_... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
f0bec661129a-31 | it as a named parameter to the constructor.
Example
# Initialise with default model and instruction
from langchain.embeddings import EmbaasEmbeddings
emb = EmbaasEmbeddings()
# Initialise with custom model and instruction
from langchain.embeddings import EmbaasEmbeddings
emb_model = "instructor-large"
emb_inst = "Repre... | https://api.python.langchain.com/en/latest/modules/embeddings.html |
c0aff4bf2256-0 | Memoryο
class langchain.memory.CassandraChatMessageHistory(contact_points, session_id, port=9042, username='cassandra', password='cassandra', keyspace_name='chat_history', table_name='message_store')[source]ο
Bases: langchain.schema.BaseChatMessageHistory
Chat message history that stores history in Cassandra.
Parameter... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-1 | None
class langchain.memory.CombinedMemory(*, memories)[source]ο
Bases: langchain.schema.BaseMemory
Class for combining multiple memoriesβ data together.
Parameters
memories (List[langchain.schema.BaseMemory]) β
Return type
None
attribute memories: List[langchain.schema.BaseMemory] [Required]ο
For tracking all the mem... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-2 | load_memory_variables(inputs)[source]ο
Return history buffer.
Parameters
inputs (Dict[str, Any]) β
Return type
Dict[str, Any]
property buffer: Anyο
String buffer of memory.
class langchain.memory.ConversationBufferWindowMemory(*, chat_memory=None, output_key=None, input_key=None, return_messages=False, human_prefix='H... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-3 | class langchain.memory.ConversationEntityMemory(*, chat_memory=None, output_key=None, input_key=None, return_messages=False, human_prefix='Human', ai_prefix='AI', llm, entity_extraction_prompt=PromptTemplate(input_variables=['history', 'input'], output_parser=None, partial_variables={}, template='You are an AI assistan... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-4 | "That sounds like 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. I\'m working with Person #2.\nOutput: Langchain, Person #2\nEND OF ... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-5 | Bases: langchain.memory.chat_memory.BaseChatMemory
Entity extractor & summarizer memory.
Extracts named entities from the recent chat history and generates summaries.
With a swapable entity store, persisting entities across conversations.
Defaults to an in-memory entity store, and can be swapped out for a Redis,
SQLite... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-6 | attribute 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 la... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-7 | 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. I\'m working with Person #2.\nOutput: Langchain, Person #2\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for ext... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-8 | attribute entity_store: langchain.memory.entity.BaseEntityStore [Optional]ο
attribute 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 h... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-9 | Parameters
inputs (Dict[str, Any]) β
Return type
Dict[str, Any]
save_context(inputs, outputs)[source]ο
Save context from this conversation history to the entity store.
Generates a summary for each entity in the entity cache by prompting
the model, and saves these summaries to the entity store.
Parameters
inputs (Dict[... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-10 | class langchain.memory.ConversationKGMemory(*, chat_memory=None, output_key=None, input_key=None, return_messages=False, k=2, human_prefix='Human', ai_prefix='AI', kg=None, knowledge_extraction_prompt=PromptTemplate(input_variables=['history', 'input'], output_parser=None, partial_variables={}, template="You are a netw... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-11 | NONE\nEND OF EXAMPLE\n\nEXAMPLE\nConversation history:\nPerson #1: What do you know about Descartes?\nAI: Descartes was a French philosopher, mathematician, and scientist who lived in the 17th century.\nPerson #1: The Descartes I'm referring to is a standup comedian and interior designer from Montreal.\nAI: Oh yes, He ... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-12 | history:\nPerson #1: how\'s it going today?\nAI: "It\'s going great! How about you?"\nPerson #1: good! busy working on Langchain. lots to do.\nAI: "That sounds like 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,... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-13 | Bases: langchain.memory.chat_memory.BaseChatMemory
Knowledge graph memory for storing conversation memory.
Integrates with external knowledge graph to store and retrieve
information about knowledge triples in the conversation.
Parameters
chat_memory (langchain.schema.BaseChatMessageHistory) β
output_key (Optional[str]... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-14 | attribute 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 la... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-15 | 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. I\'m working with Person #2.\nOutput: Langchain, Person #2\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for ext... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-16 | attribute human_prefix: str = 'Human'ο
attribute k: int = 2ο
attribute kg: langchain.graphs.networkx_graph.NetworkxEntityGraph [Optional]ο | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-17 | attribute 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 integ... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-18 | Descartes was a French philosopher, mathematician, and scientist who lived in the 17th century.\nPerson #1: The Descartes I'm referring to is a standup comedian and interior designer from Montreal.\nAI: Oh yes, He is a comedian and an interior designer. He has been in the industry for 30 years. His favorite food is bak... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-19 | attribute llm: langchain.base_language.BaseLanguageModel [Required]ο
attribute summary_message_cls: Type[langchain.schema.BaseMessage] = <class 'langchain.schema.SystemMessage'>ο
Number of previous utterances to include in the context.
clear()[source]ο
Clear memory contents.
Return type
None
get_current_entities(input_... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-20 | attribute input_key: Optional[str] = Noneο
attribute output_key: Optional[str] = Noneο
clear()[source]ο
Clear memory contents.
Return type
None
load_memory_variables(inputs)[source]ο
Return history buffer.
Parameters
inputs (Dict[str, Any]) β
Return type
Dict[str, str]
save_context(inputs, outputs)[source]ο
Save conte... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-21 | Will always return list of memory variables.
:meta private:
class langchain.memory.ConversationSummaryBufferMemory(*, human_prefix='Human', ai_prefix='AI', llm, prompt=PromptTemplate(input_variables=['summary', 'new_lines'], output_parser=None, partial_variables={}, template='Progressively summarize the lines of conver... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-22 | output_key (Optional[str]) β
input_key (Optional[str]) β
return_messages (bool) β
max_token_limit (int) β
moving_summary_buffer (str) β
memory_key (str) β
Return type
None
attribute max_token_limit: int = 2000ο
attribute memory_key: str = 'history'ο
attribute moving_summary_buffer: str = ''ο
clear()[source]ο
Clea... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-23 | Return type
None
property buffer: List[langchain.schema.BaseMessage]ο
class langchain.memory.ConversationSummaryMemory(*, human_prefix='Human', ai_prefix='AI', llm, prompt=PromptTemplate(input_variables=['summary', 'new_lines'], output_parser=None, partial_variables={}, template='Progressively summarize the lines of co... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-24 | input_key (Optional[str]) β
return_messages (bool) β
buffer (str) β
memory_key (str) β
Return type
None
attribute buffer: str = ''ο
clear()[source]ο
Clear memory contents.
Return type
None
classmethod from_messages(llm, chat_memory, *, summarize_step=2, **kwargs)[source]ο
Parameters
llm (langchain.base_language.Bas... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-25 | max_token_limit (int) β
Return type
None
attribute ai_prefix: str = 'AI'ο
attribute human_prefix: str = 'Human'ο
attribute llm: langchain.base_language.BaseLanguageModel [Required]ο
attribute max_token_limit: int = 2000ο
attribute memory_key: str = 'history'ο
load_memory_variables(inputs)[source]ο
Return history buffe... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-26 | Retrieve the messages from Cosmos
Return type
None
add_message(message)[source]ο
Add a self-created message to the store
Parameters
message (langchain.schema.BaseMessage) β
Return type
None
upsert_messages()[source]ο
Update the cosmosdb item.
Return type
None
clear()[source]ο
Clear session memory from this memory and ... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-27 | Parameters
file_path (str) β path of the local file to store the messages.
property messages: List[langchain.schema.BaseMessage]ο
Retrieve the messages from the local file
add_message(message)[source]ο
Append the message to the record in the local file
Parameters
message (langchain.schema.BaseMessage) β
Return type
No... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-28 | See https://gomomento.com/
Parameters
session_id (str) β
cache_client (momento.CacheClient) β
cache_name (str) β
key_prefix (str) β
ttl (Optional[timedelta]) β
ensure_cache_exists (bool) β
classmethod from_client_params(session_id, cache_name, ttl, *, configuration=None, auth_token=None, **kwargs)[source]ο
Constr... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-29 | session_id (str) β arbitrary key that is used to store the messages
of a single chat session.
database_name (str) β name of the database to use
collection_name (str) β name of the collection to use
property messages: List[langchain.schema.BaseMessage]ο
Retrieve the messages from MongoDB
add_message(message)[source]ο
Ap... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-30 | Delete a session
Return type
None
async init()[source]ο
Return type
None
load_memory_variables(values)[source]ο
Return key-value pairs given the text input to the chain.
If None, return all memories
Parameters
values (Dict[str, Any]) β
Return type
Dict[str, Any]
save_context(inputs, outputs)[source]ο
Save context from... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-31 | Nothing to clear, got a memory like a vault.
Return type
None
load_memory_variables(inputs)[source]ο
Load memory variables from memory.
Parameters
inputs (Dict[str, Any]) β
Return type
Dict[str, str]
save_context(inputs, outputs)[source]ο
Nothing should be saved or changed
Parameters
inputs (Dict[str, Any]) β
outputs... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-32 | that TTL is extended by 3 days every time the entity is read back.
Parameters
session_id (str) β
url (str) β
key_prefix (str) β
ttl (Optional[int]) β
recall_ttl (Optional[int]) β
args (Any) β
redis_client (Any) β
Return type
None
attribute key_prefix: str = 'memory_store'ο
attribute recall_ttl: Optional[int] = 2... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-33 | property messages: List[langchain.schema.BaseMessage]ο
Retrieve all messages from db
add_message(message)[source]ο
Append the message to the record in db
Parameters
message (langchain.schema.BaseMessage) β
Return type
None
clear()[source]ο
Clear session memory from db
Return type
None
class langchain.memory.SQLiteEnti... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-34 | Simple memory for storing context or other bits of information that shouldnβt
ever change between prompts.
Parameters
memories (Dict[str, Any]) β
Return type
None
attribute memories: Dict[str, Any] = {}ο
clear()[source]ο
Nothing to clear, got a memory like a vault.
Return type
None
load_memory_variables(inputs)[source... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-35 | attribute return_docs: bool = Falseο
Whether or not to return the result of querying the database directly.
clear()[source]ο
Nothing to clear.
Return type
None
load_memory_variables(inputs)[source]ο
Return history buffer.
Parameters
inputs (Dict[str, Any]) β
Return type
Dict[str, Union[List[langchain.schema.Document],... | https://api.python.langchain.com/en/latest/modules/memory.html |
c0aff4bf2256-36 | properties.
For more information on the zep-python package, see:
https://github.com/getzep/zep-python
Parameters
session_id (str) β
url (str) β
Return type
None
property messages: List[langchain.schema.BaseMessage]ο
Retrieve messages from Zep memory
property zep_messages: List[Message]ο
Retrieve summary from Zep memo... | https://api.python.langchain.com/en/latest/modules/memory.html |
025b560d46c1-0 | Output Parsersο
class langchain.output_parsers.BooleanOutputParser(*, true_val='YES', false_val='NO')[source]ο
Bases: langchain.schema.BaseOutputParser[bool]
Parameters
true_val (str) β
false_val (str) β
Return type
None
attribute false_val: str = 'NO'ο
attribute true_val: str = 'YES'ο
parse(text)[source]ο
Parse the ... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
025b560d46c1-1 | Parameters
text (str) β
Return type
List[str]
class langchain.output_parsers.DatetimeOutputParser(*, format='%Y-%m-%dT%H:%M:%S.%fZ')[source]ο
Bases: langchain.schema.BaseOutputParser[datetime.datetime]
Parameters
format (str) β
Return type
None
attribute format: str = '%Y-%m-%dT%H:%M:%S.%fZ'ο
get_format_instructions(... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
025b560d46c1-2 | Bases: langchain.schema.BaseOutputParser
Parameters
guard (Any) β
api (Optional[Callable]) β
args (Any) β
kwargs (Any) β
Return type
None
attribute api: Optional[Callable] = Noneο
attribute args: Any = Noneο
attribute guard: Any = Noneο
attribute kwargs: Any = Noneο
classmethod from_rail(rail_file, num_reasks=1, ap... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
025b560d46c1-3 | Class to parse the output of an LLM call to a list.
Return type
None
abstract parse(text)[source]ο
Parse the output of an LLM call.
Parameters
text (str) β
Return type
List[str]
class langchain.output_parsers.OutputFixingParser(*, parser, retry_chain)[source]ο
Bases: langchain.schema.BaseOutputParser[langchain.output_... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
025b560d46c1-4 | get_format_instructions()[source]ο
Instructions on how the LLM output should be formatted.
Return type
str
parse(completion)[source]ο
Parse the output of an LLM call.
A method which takes in a string (assumed output of a language model )
and parses it into some structure.
Parameters
text β output of language model
comp... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
025b560d46c1-5 | no_update_value (Optional[str]) β
Return type
None
attribute no_update_value: Optional[str] = Noneο
attribute output_key_to_format: Dict[str, str] [Required]ο
attribute regex_pattern: str = "{}:\\s?([^.'\\n']*)\\.?"ο
parse(text)[source]ο
Parse the output of an LLM call.
Parameters
text (str) β
Return type
Dict[str, s... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
025b560d46c1-6 | Wraps a parser and tries to fix parsing errors.
Does this by passing the original prompt and the completion to another
LLM, and telling it the completion did not satisfy criteria in the prompt.
Parameters
parser (langchain.schema.BaseOutputParser[langchain.output_parsers.retry.T]) β
retry_chain (langchain.chains.llm.L... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
025b560d46c1-7 | parse_with_prompt(completion, prompt_value)[source]ο
Optional method to parse the output of an LLM call with a prompt.
The prompt is largely provided in the event the OutputParser wants
to retry or fix the output in some way, and needs information from
the prompt to do so.
Parameters
completion (str) β output of langua... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
025b560d46c1-8 | attribute retry_chain: langchain.chains.llm.LLMChain [Required]ο
classmethod from_llm(llm, parser, prompt=PromptTemplate(input_variables=['completion', 'error', 'prompt'], output_parser=None, partial_variables={}, template='Prompt:\n{prompt}\nCompletion:\n{completion}\n\nAbove, the Completion did not satisfy the constr... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
025b560d46c1-9 | Returns
structured output
Return type
langchain.output_parsers.retry.T
class langchain.output_parsers.StructuredOutputParser(*, response_schemas)[source]ο
Bases: langchain.schema.BaseOutputParser
Parameters
response_schemas (List[langchain.output_parsers.structured.ResponseSchema]) β
Return type
None
attribute respons... | https://api.python.langchain.com/en/latest/modules/output_parsers.html |
1ace37f9e39e-0 | Toolsο
Core toolkit implementations.
class langchain.tools.AIPluginTool(*, name, description, args_schema=<class 'langchain.tools.plugin.AIPluginToolSchema'>, return_direct=False, verbose=False, callbacks=None, callback_manager=None, handle_tool_error=False, plugin, api_spec)[source]ο
Bases: langchain.tools.base.BaseTo... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-1 | base_url (str) β
path (str) β
method (langchain.utilities.openapi.HTTPVerb) β
properties (Sequence[langchain.tools.openapi.utils.api_models.APIProperty]) β
request_body (Optional[langchain.tools.openapi.utils.api_models.APIRequestBody]) β
Return type
None
attribute base_url: str [Required]ο
The base URL of the ope... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-2 | Return type
str
static ts_type_from_python(type_)[source]ο
Parameters
type_ (Union[str, Type, tuple, None, enum.Enum]) β
Return type
str
property body_params: List[str]ο
property path_params: List[str]ο
property query_params: List[str]ο
class langchain.tools.ArxivQueryRun(*, name='arxiv', description='A wrapper around... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-3 | attribute api_wrapper: langchain.utilities.arxiv.ArxivAPIWrapper [Optional]ο
class langchain.tools.AzureCogsFormRecognizerTool(*, name='azure_cognitive_services_form_recognizer', description='A wrapper around Azure Cognitive Services Form Recognizer. Useful for when you need to extract text, tables, and key-value pairs... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-4 | doc_analysis_client (Any) β
Return type
None
class langchain.tools.AzureCogsImageAnalysisTool(*, name='azure_cognitive_services_image_analysis', description='A wrapper around Azure Cognitive Services Image Analysis. Useful for when you need to analyze images. Input should be a url to an image.', args_schema=None, retu... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-5 | analysis_options (Any) β
Return type
None
class langchain.tools.AzureCogsSpeech2TextTool(*, name='azure_cognitive_services_speech2text', description='A wrapper around Azure Cognitive Services Speech2Text. Useful for when you need to transcribe audio to text. Input should be a url to an audio file.', args_schema=None, ... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-6 | speech_config (Any) β
Return type
None
class langchain.tools.AzureCogsText2SpeechTool(*, name='azure_cognitive_services_text2speech', description='A wrapper around Azure Cognitive Services Text2Speech. Useful for when you need to convert text to speech. ', args_schema=None, return_direct=False, verbose=False, callback... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-7 | speech_config (Any) β
Return type
None
class langchain.tools.BaseGraphQLTool(*, name='query_graphql', description="Β Β Β Input to this tool is a detailed and correct GraphQL query, output is a result from the API.\nΒ Β Β If the query is not correct, an error message will be returned.\nΒ Β Β If an error is returned with 'Bad... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-8 | Parameters
requests_wrapper (langchain.requests.TextRequestsWrapper) β
Return type
None
attribute requests_wrapper: langchain.requests.TextRequestsWrapper [Required]ο
class langchain.tools.BaseSQLDatabaseTool(*, db)[source]ο
Bases: pydantic.main.BaseModel
Base tool for interacting with a SQL database.
Parameters
db (l... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-9 | attribute args_schema: Optional[Type[pydantic.main.BaseModel]] = Noneο
Pydantic model class to validate and parse the toolβs input arguments.
attribute callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = Noneο
Deprecated. Please use callbacks instead.
attribute callbacks: Optional[Union[List[lang... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-10 | kwargs (Any) β
Return type
Any
run(tool_input, verbose=None, start_color='green', color='green', callbacks=None, **kwargs)[source]ο
Run the tool.
Parameters
tool_input (Union[str, Dict]) β
verbose (Optional[bool]) β
start_color (Optional[str]) β
color (Optional[str]) β
callbacks (Optional[Union[List[langchain.call... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-11 | num_results (int) β
api_wrapper (langchain.utilities.bing_search.BingSearchAPIWrapper) β
Return type
None
attribute api_wrapper: langchain.utilities.bing_search.BingSearchAPIWrapper [Required]ο
attribute num_results: int = 4ο
class langchain.tools.BingSearchRun(*, name='bing_search', description='A wrapper around Bin... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-12 | Bases: langchain.tools.base.BaseTool
Parameters
name (str) β
description (str) β
args_schema (Optional[Type[pydantic.main.BaseModel]]) β
return_direct (bool) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-13 | callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) β
sync_browser (Optional['SyncBrowser']) β
async_browser (Optional['AsyncBrowser']) β
visible_only (bool) β
playwright_strict (bool) β
pla... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-14 | Parameters
name (str) β
description (str) β
args_schema (Type[pydantic.main.BaseModel]) β
return_direct (bool) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_manager (Optional[langchain.callbacks.base.Base... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-15 | return_direct (bool) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.b... | https://api.python.langchain.com/en/latest/modules/tools.html |
1ace37f9e39e-16 | callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
handle_tool_error (Optional[Union[bool, str, Callable[[langchain.tools.base.ToolException], str]]]) β
root_dir (Optional[str]) β
Return type
None
attribute args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.file_management.... | https://api.python.langchain.com/en/latest/modules/tools.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.