id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
0d6e7b01bb24-1
load_schema() Load the graph schema information. query(query) Query the graph. update(query) Update the graph. __init__(source_file: Optional[str] = None, serialization: Optional[str] = 'ttl', query_endpoint: Optional[str] = None, update_endpoint: Optional[str] = None, standard: Optional[str] = 'rdf', local_copy: Optio...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.rdf_graph.RdfGraph.html
6eef03a5a44e-0
langchain.graphs.graph_document.GraphDocument¶ class langchain.graphs.graph_document.GraphDocument[source]¶ Bases: Serializable Represents a graph document consisting of nodes and relationships. nodes¶ A list of nodes in the graph. Type List[Node] relationships¶ A list of relationships in the graph. Type List[Relations...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.GraphDocument.html
6eef03a5a44e-1
the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[boo...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.GraphDocument.html
6eef03a5a44e-2
A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classm...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.GraphDocument.html
8513d83af50e-0
langchain.graphs.falkordb_graph.FalkorDBGraph¶ class langchain.graphs.falkordb_graph.FalkorDBGraph(database: str, host: str = 'localhost', port: int = 6379, username: Optional[str] = None, password: Optional[str] = None, ssl: bool = False)[source]¶ FalkorDB wrapper for graph operations. Security note: Make sure that th...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.falkordb_graph.FalkorDBGraph.html
8513d83af50e-1
Create a new FalkorDB graph wrapper instance. add_graph_documents(graph_documents: List[GraphDocument], include_source: bool = False) → None[source]¶ Take GraphDocument as input as uses it to construct a graph. query(query: str, params: dict = {}) → List[Dict[str, Any]][source]¶ Query FalkorDB database. refresh_schema(...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.falkordb_graph.FalkorDBGraph.html
f1caadfcdd6b-0
langchain.graphs.neo4j_graph.Neo4jGraph¶ class langchain.graphs.neo4j_graph.Neo4jGraph(url: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, database: str = 'neo4j')[source]¶ Neo4j wrapper for graph operations. Security note: Make sure that the database connection uses credentialsth...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.neo4j_graph.Neo4jGraph.html
f1caadfcdd6b-1
Take GraphDocument as input as uses it to construct a graph. query(query: str, params: dict = {}) → List[Dict[str, Any]][source]¶ Query Neo4j database. refresh_schema() → None[source]¶ Refreshes the Neo4j graph schema information. Examples using Neo4jGraph¶ Neo4j Diffbot Graph Transformer Neo4j DB QA chain
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.neo4j_graph.Neo4jGraph.html
cc77fedc2afc-0
langchain.graphs.networkx_graph.NetworkxEntityGraph¶ class langchain.graphs.networkx_graph.NetworkxEntityGraph(graph: Optional[Any] = None)[source]¶ Networkx wrapper for entity graph operations. Security note: Make sure that the database connection uses credentialsthat are narrowly-scoped to only include necessary perm...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.NetworkxEntityGraph.html
cc77fedc2afc-1
draw_graphviz(**kwargs: Any) → None[source]¶ Provides better drawing Usage in a jupyter notebook: >>> from IPython.display import SVG >>> self.draw_graphviz_svg(layout="dot", filename="web.svg") >>> SVG('web.svg') classmethod from_gml(gml_path: str) → NetworkxEntityGraph[source]¶ get_entity_knowledge(entity: str, depth...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.NetworkxEntityGraph.html
77fe050102bc-0
langchain.graphs.memgraph_graph.MemgraphGraph¶ class langchain.graphs.memgraph_graph.MemgraphGraph(url: str, username: str, password: str, *, database: str = 'memgraph')[source]¶ Memgraph wrapper for graph operations. Security note: Make sure that the database connection uses credentialsthat are narrowly-scoped to only...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.memgraph_graph.MemgraphGraph.html
77fe050102bc-1
Query Neo4j database. refresh_schema() → None[source]¶ Refreshes the Memgraph graph schema information. Examples using MemgraphGraph¶ Memgraph QA chain
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.memgraph_graph.MemgraphGraph.html
6767b6c855b8-0
langchain.graphs.graph_document.Relationship¶ class langchain.graphs.graph_document.Relationship[source]¶ Bases: Serializable Represents a directed relationship between two nodes in a graph. source¶ The source node of the relationship. Type Node target¶ The target node of the relationship. Type Node type¶ The type of t...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Relationship.html
6767b6c855b8-1
the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[boo...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Relationship.html
6767b6c855b8-2
A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classm...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Relationship.html
4db7acbbd147-0
langchain.graphs.neptune_graph.NeptuneQueryException¶ class langchain.graphs.neptune_graph.NeptuneQueryException(exception: Union[str, Dict])[source]¶ A class to handle queries that fail to execute
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.neptune_graph.NeptuneQueryException.html
25ef9fd27952-0
langchain.graphs.graph_store.GraphStore¶ class langchain.graphs.graph_store.GraphStore[source]¶ An abstract class wrapper for graph operations. Attributes get_schema Returns the schema of the Graph database get_structured_schema Returns the schema of the Graph database Methods __init__() add_graph_documents(graph_docum...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_store.GraphStore.html
2220aa1b9347-0
langchain.graphs.graph_document.Node¶ class langchain.graphs.graph_document.Node[source]¶ Bases: Serializable Represents a node in a graph with associated properties. id¶ A unique identifier for the node. Type Union[str, int] type¶ The type or label of the node, default is “Node”. Type str properties¶ Additional proper...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Node.html
2220aa1b9347-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Node.html
2220aa1b9347-2
The unique identifier is a list of strings that describes the path to the object. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Uni...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Node.html
964dfea21381-0
langchain.graphs.networkx_graph.get_entities¶ langchain.graphs.networkx_graph.get_entities(entity_str: str) → List[str][source]¶ Extract entities from entity string.
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.get_entities.html
be0ddd3d8afd-0
langchain.graphs.networkx_graph.parse_triples¶ langchain.graphs.networkx_graph.parse_triples(knowledge_str: str) → List[KnowledgeTriple][source]¶ Parse knowledge triples from the knowledge string.
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.parse_triples.html
0fa31c184a0f-0
langchain.graphs.arangodb_graph.get_arangodb_client¶ langchain.graphs.arangodb_graph.get_arangodb_client(url: Optional[str] = None, dbname: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None) → Any[source]¶ Get the Arango DB client from credentials. Parameters url – Arango DB url. Can ...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.arangodb_graph.get_arangodb_client.html
b7684ba0a1a4-0
langchain.graphs.nebula_graph.NebulaGraph¶ class langchain.graphs.nebula_graph.NebulaGraph(space: str, username: str = 'root', password: str = 'nebula', address: str = '127.0.0.1', port: int = 9669, session_pool_size: int = 30)[source]¶ NebulaGraph wrapper for graph operations. NebulaGraph inherits methods from Neo4jGr...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.nebula_graph.NebulaGraph.html
b7684ba0a1a4-1
Create a new NebulaGraph wrapper instance. execute(query: str, params: Optional[dict] = None, retry: int = 0) → Any[source]¶ Query NebulaGraph database. query(query: str, retry: int = 0) → Dict[str, Any][source]¶ refresh_schema() → None[source]¶ Refreshes the NebulaGraph schema information. Examples using NebulaGraph¶ ...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.nebula_graph.NebulaGraph.html
42a6bca9ef73-0
langchain.graphs.kuzu_graph.KuzuGraph¶ class langchain.graphs.kuzu_graph.KuzuGraph(db: Any, database: str = 'kuzu')[source]¶ Kùzu wrapper for graph operations. Security note: Make sure that the database connection uses credentialsthat are narrowly-scoped to only include necessary permissions. Failure to do so may resul...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.kuzu_graph.KuzuGraph.html
ff765c3a274d-0
langchain.graphs.hugegraph.HugeGraph¶ class langchain.graphs.hugegraph.HugeGraph(username: str = 'default', password: str = 'default', address: str = '127.0.0.1', port: int = 8081, graph: str = 'hugegraph')[source]¶ HugeGraph wrapper for graph operations. Security note: Make sure that the database connection uses crede...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.hugegraph.HugeGraph.html
60d9c90a9acb-0
langchain.graphs.arangodb_graph.ArangoGraph¶ class langchain.graphs.arangodb_graph.ArangoGraph(db: Any)[source]¶ ArangoDB wrapper for graph operations. Security note: Make sure that the database connection uses credentialsthat are narrowly-scoped to only include necessary permissions. Failure to do so may result in dat...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.arangodb_graph.ArangoGraph.html
60d9c90a9acb-1
Convenience constructor that builds Arango DB from credentials. Parameters url – Arango DB url. Can be passed in as named arg or set as environment var ARANGODB_URL. Defaults to “http://localhost:8529”. dbname – Arango DB name. Can be passed in as named arg or set as environment var ARANGODB_DBNAME. Defaults to “_syste...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.arangodb_graph.ArangoGraph.html
1a9522a35e73-0
langchain.graphs.neptune_graph.NeptuneGraph¶ class langchain.graphs.neptune_graph.NeptuneGraph(host: str, port: int = 8182, use_https: bool = True, client: Any = None, credentials_profile_name: Optional[str] = None, region_name: Optional[str] = None, service: str = 'neptunedata', sign: bool = True)[source]¶ Neptune wra...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.neptune_graph.NeptuneGraph.html
1a9522a35e73-1
query(query[, params]) Query Neptune database. __init__(host: str, port: int = 8182, use_https: bool = True, client: Any = None, credentials_profile_name: Optional[str] = None, region_name: Optional[str] = None, service: str = 'neptunedata', sign: bool = True) → None[source]¶ Create a new Neptune graph wrapper instance...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.neptune_graph.NeptuneGraph.html
84654b042bf6-0
langchain.graphs.networkx_graph.KnowledgeTriple¶ class langchain.graphs.networkx_graph.KnowledgeTriple(subject: str, predicate: str, object_: str)[source]¶ A triple in the graph. Create new instance of KnowledgeTriple(subject, predicate, object_) Attributes object_ Alias for field number 2 predicate Alias for field num...
lang/api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.KnowledgeTriple.html
c70b98bdb4cd-0
langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain¶ class langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain[source]¶ Bases: Chain Chain that interprets a prompt and executes python code to do symbolic math. Example from langchain.chains import LLMSymbolicMathChain from langchain.llms im...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-1
and passed as arguments to the handlers defined in callbacks. You can use these to eg identify a specific instance of a chain with its use case. param tags: Optional[List[str]] = None¶ Optional list of tags associated with the chain. Defaults to None. These tags will be associated with each call to this chain, and pass...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-2
tags – List of string tags to pass to all callbacks. These will be passed in addition to tags passed to the chain during construction, but only these runtime tags will propagate to calls to other objects. metadata – Optional metadata associated with the chain. Defaults to None include_run_info – Whether to include run ...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-3
chain will be returned. Defaults to False. callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-4
with all the inputs Parameters *args – If the chain expects a single input, it can be passed in as the sole positional argument. callbacks – Callbacks to use for this chain run. These will be called in addition to callbacks passed to the chain during construction, but only these runtime callbacks will propagate to call...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-5
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-6
e.g., if the underlying runnable uses an API which supports a batch mode. bind(**kwargs: Any) → Runnable[Input, Output]¶ Bind arguments to a Runnable, returning a new Runnable. config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶ The type of config this runnable accepts specified as a pydantic m...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-7
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(**kw...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-8
# -> {"_type": "foo", "verbose": False, ...} classmethod from_llm(llm: BaseLanguageModel, prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], template='Translate a math problem into a expression that can be executed using Python\'s SymPy library. Use the output of running this code to answer the q...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-9
classmethod from_orm(obj: Any) → Model¶ get_input_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ Get a pydantic model that can be used to validate input to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic input schema that depend...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-10
purposes, ‘max_concurrency’ for controlling how much work to do in parallel, and other keys. Please refer to the RunnableConfig for more details. Returns The output of the runnable. classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]]...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-11
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶ Validate and prepare chain inputs, including adding inputs from memory. Parameters inputs – Dictionary of raw inputs, or single input if chain expects only one param. Should contain all inputs specified in Chain.input_keys except for inputs that will be ...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-12
these runtime callbacks will propagate to calls to other objects. tags – List of string tags to pass to all callbacks. These will be passed in addition to tags passed to the chain during construction, but only these runtime tags will propagate to calls to other objects. **kwargs – If the chain expects multiple inputs, ...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-13
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶ to_json_not_implemented() → SerializedNotImplemented¶ transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of transform, which buffers input and then calls stream...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-14
on_error: Called if the runnable throws an error, with the Run object. The Run object contains information about the run, including its id, type, input, output, error, start_time, end_time, and any tags or metadata added to the run. with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] ...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
c70b98bdb4cd-15
These attributes must be accepted by the constructor. property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_schema: Type[pydantic.main.BaseModel]¶ The type of output this runnable produces specified as a pydantic model. E...
lang/api.python.langchain.com/en/latest/llm_symbolic_math/langchain_experimental.llm_symbolic_math.base.LLMSymbolicMathChain.html
ddd8366112fb-0
langchain.cache.FullLLMCache¶ class langchain.cache.FullLLMCache(**kwargs)[source]¶ SQLite table for full LLM Cache (all generations). A simple constructor that allows initialization from kwargs. Sets attributes on the constructed instance using the names and values in kwargs. Only keys that are present as attributes o...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.FullLLMCache.html
41363e5a12be-0
langchain.cache.FullMd5LLMCache¶ class langchain.cache.FullMd5LLMCache(**kwargs)[source]¶ SQLite table for full LLM Cache (all generations). A simple constructor that allows initialization from kwargs. Sets attributes on the constructed instance using the names and values in kwargs. Only keys that are present as attrib...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.FullMd5LLMCache.html
454bc31da1b8-0
langchain.cache.RedisSemanticCache¶ class langchain.cache.RedisSemanticCache(redis_url: str, embedding: Embeddings, score_threshold: float = 0.2)[source]¶ Cache that uses Redis as a vector-store backend. Initialize by passing in the init GPTCache func Parameters redis_url (str) – URL to connect to Redis. embedding (Emb...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.RedisSemanticCache.html
454bc31da1b8-1
set_llm_cache(RedisSemanticCache( redis_url="redis://localhost:6379", embedding=OpenAIEmbeddings() )) clear(**kwargs: Any) → None[source]¶ Clear semantic cache for a given llm_string. lookup(prompt: str, llm_string: str) → Optional[Sequence[Generation]][source]¶ Look up based on prompt and llm_string. update(pr...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.RedisSemanticCache.html
6b64fd0beea2-0
langchain.cache.CassandraCache¶ class langchain.cache.CassandraCache(session: Optional[CassandraSession] = None, keyspace: Optional[str] = None, table_name: str = 'langchain_llm_cache', ttl_seconds: Optional[int] = None, skip_provisioning: bool = False)[source]¶ Cache that uses Cassandra / Astra DB as a backend. It use...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.CassandraCache.html
6b64fd0beea2-1
A wrapper around delete with the LLM being passed. lookup(prompt, llm_string) Look up based on prompt and llm_string. update(prompt, llm_string, return_val) Update cache based on prompt and llm_string. __init__(session: Optional[CassandraSession] = None, keyspace: Optional[str] = None, table_name: str = 'langchain_llm_...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.CassandraCache.html
602ded01a747-0
langchain.cache.SQLAlchemyMd5Cache¶ class langchain.cache.SQLAlchemyMd5Cache(engine: ~sqlalchemy.engine.base.Engine, cache_schema: ~typing.Type[~langchain.cache.FullMd5LLMCache] = <class 'langchain.cache.FullMd5LLMCache'>)[source]¶ Cache that uses SQAlchemy as a backend. Initialize by creating all tables. Methods __ini...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.SQLAlchemyMd5Cache.html
25ae951a9068-0
langchain.cache.MomentoCache¶ class langchain.cache.MomentoCache(cache_client: momento.CacheClient, cache_name: str, *, ttl: Optional[timedelta] = None, ensure_cache_exists: bool = True)[source]¶ Cache that uses Momento as a backend. See https://gomomento.com/ Instantiate a prompt cache using Momento as a backend. Note...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.MomentoCache.html
25ae951a9068-1
Instantiate a prompt cache using Momento as a backend. Note: to instantiate the cache client passed to MomentoCache, you must have a Momento account. See https://gomomento.com/. Parameters cache_client (CacheClient) – The Momento cache client. cache_name (str) – The name of the cache to use to store the data. ttl (Opti...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.MomentoCache.html
25ae951a9068-2
Store llm generations in cache. Parameters prompt (str) – The prompt run through the language model. llm_string (str) – The language model string. return_val (RETURN_VAL_TYPE) – A list of language model generations. Raises SdkException – Momento service or network error Exception – Unexpected response Examples using Mo...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.MomentoCache.html
887cf4117a62-0
langchain.cache.GPTCache¶ class langchain.cache.GPTCache(init_func: Optional[Union[Callable[[Any, str], None], Callable[[Any], None]]] = None)[source]¶ Cache that uses GPTCache as a backend. Initialize by passing in init function (default: None). Parameters init_func (Optional[Callable[[Any], None]]) – init GPTCache fu...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.GPTCache.html
887cf4117a62-1
# Initialize GPTCache with a custom init function import gptcache from gptcache.processor.pre import get_prompt from gptcache.manager.factory import get_data_manager from langchain.globals import set_llm_cache # Avoid multiple caches using the same file, causing different llm model caches to affect each other def init_...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.GPTCache.html
f9be7f5666ca-0
langchain.cache.InMemoryCache¶ class langchain.cache.InMemoryCache[source]¶ Cache that stores things in memory. Initialize with empty cache. Methods __init__() Initialize with empty cache. clear(**kwargs) Clear cache. lookup(prompt, llm_string) Look up based on prompt and llm_string. update(prompt, llm_string, return_v...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.InMemoryCache.html
d303a8a6e5c3-0
langchain.cache.SQLiteCache¶ class langchain.cache.SQLiteCache(database_path: str = '.langchain.db')[source]¶ Cache that uses SQLite as a backend. Initialize by creating the engine and all tables. Methods __init__([database_path]) Initialize by creating the engine and all tables. clear(**kwargs) Clear cache. lookup(pro...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.SQLiteCache.html
0042dc44a83b-0
langchain.cache.RedisCache¶ class langchain.cache.RedisCache(redis_: Any, *, ttl: Optional[int] = None)[source]¶ Cache that uses Redis as a backend. Initialize an instance of RedisCache. This method initializes an object with Redis caching capabilities. It takes a redis_ parameter, which should be an instance of a Redi...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.RedisCache.html
0042dc44a83b-1
If provided, it sets the time duration for how long cached items will remain valid. If not provided, cached items will not have an automatic expiration. clear(**kwargs: Any) → None[source]¶ Clear cache. If asynchronous is True, flush asynchronously. lookup(prompt: str, llm_string: str) → Optional[Sequence[Generation]][...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.RedisCache.html
a84e5779f7af-0
langchain.cache.UpstashRedisCache¶ class langchain.cache.UpstashRedisCache(redis_: Any, *, ttl: Optional[int] = None)[source]¶ Cache that uses Upstash Redis as a backend. Initialize an instance of UpstashRedisCache. This method initializes an object with Upstash Redis caching capabilities. It takes a redis_ parameter, ...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.UpstashRedisCache.html
a84e5779f7af-1
This allows the object to communicate with Redis server for caching operations on. ttl (int, optional) – Time-to-live (TTL) for cached items in seconds. If provided, it sets the time duration for how long cached items will remain valid. If not provided, cached items will not have an automatic expiration. clear(**kwargs...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.UpstashRedisCache.html
95b051bd9b2e-0
langchain.cache.SQLAlchemyCache¶ class langchain.cache.SQLAlchemyCache(engine: ~sqlalchemy.engine.base.Engine, cache_schema: ~typing.Type[~langchain.cache.FullLLMCache] = <class 'langchain.cache.FullLLMCache'>)[source]¶ Cache that uses SQAlchemy as a backend. Initialize by creating all tables. Methods __init__(engine[,...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.SQLAlchemyCache.html
86502af505b3-0
langchain.cache.CassandraSemanticCache¶ class langchain.cache.CassandraSemanticCache(session: Optional[CassandraSession], keyspace: Optional[str], embedding: Embeddings, table_name: str = 'langchain_llm_semantic_cache', distance_metric: str = 'dot', score_threshold: float = 0.85, ttl_seconds: Optional[int] = None, skip...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.CassandraSemanticCache.html
86502af505b3-1
Methods __init__(session, keyspace, embedding[, ...]) Initialize the cache with all relevant parameters. :param session: an open Cassandra session :type session: cassandra.cluster.Session :param keyspace: the keyspace to use for storing the cache :type keyspace: str :param embedding: Embedding provider for semantic ...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.CassandraSemanticCache.html
86502af505b3-2
Initialize the cache with all relevant parameters. :param session: an open Cassandra session :type session: cassandra.cluster.Session :param keyspace: the keyspace to use for storing the cache :type keyspace: str :param embedding: Embedding provider for semantic encoding and search. Parameters table_name (str) – name o...
lang/api.python.langchain.com/en/latest/cache/langchain.cache.CassandraSemanticCache.html
86502af505b3-3
Update cache based on prompt and llm_string.
lang/api.python.langchain.com/en/latest/cache/langchain.cache.CassandraSemanticCache.html
ee177465870a-0
langchain.llms.base.get_prompts¶ langchain.llms.base.get_prompts(params: Dict[str, Any], prompts: List[str]) → Tuple[Dict[int, List], str, List[int], List[str]][source]¶ Get prompts that are already cached.
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.get_prompts.html
1f2fea10ccf9-0
langchain.llms.beam.Beam¶ class langchain.llms.beam.Beam[source]¶ Bases: LLM Beam API for gpt2 large language model. To use, you should have the beam-sdk python package installed, and the environment variable BEAM_CLIENT_ID set with your client id and BEAM_CLIENT_SECRET set with your client secret. Information on how t...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-1
param gpu: str = ''¶ param max_length: str = ''¶ param memory: str = ''¶ param metadata: Optional[Dict[str, Any]] = None¶ Metadata to add to the run trace. param model_kwargs: Dict[str, Any] [Optional]¶ Holds any model parameters valid for create call not explicitly specified. param model_name: str = ''¶ param name: st...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-2
e.g., if the underlying runnable uses an API which supports a batch mode. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, *, tags: Optional[Union[Li...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-3
functionality, such as logging or streaming, throughout generation. **kwargs – Arbitrary additional keyword arguments. These are usually passed to the model provider API call. Returns An LLMResult, which contains a list of candidate Generations for each inputprompt and additional model provider-specific output. async a...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-4
Parameters messages – A sequence of chat messages corresponding to a single model input. stop – Stop words to use when generating. Model output is cut off at the first occurrence of any of these substrings. **kwargs – Arbitrary additional keyword arguments. These are usually passed to the model provider API call. Retur...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-5
Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can start producing output while input is still being generated. batch(inputs: List[Union[PromptValue, str, List[BaseMessage]]], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = Non...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-6
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-7
Run the LLM on the given prompt and input. generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, **kwargs: Any) → LLMResult¶ Pass a sequence of pr...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-8
This method allows to get an input schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate input. classmethod get_lc_namespace() → List[str]¶ Get the namespace of the langchain object. For example, if the class is langcha...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-9
Parameters text – The string input to tokenize. Returns A list of ids corresponding to the tokens in the text, in order they occurin the text. invoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → str¶ Transform a single ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-10
to the object. map() → Runnable[List[Input], List[Output]]¶ Return a new Runnable that maps a list of inputs to a list of outputs, by calling invoke() with each input. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool =...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-11
first occurrence of any of these substrings. **kwargs – Arbitrary additional keyword arguments. These are usually passed to the model provider API call. Returns Top model prediction as a message. run_creation() → None[source]¶ Creates a Python file which will be deployed on beam. save(file_path: Union[Path, str]) → Non...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-12
classmethod validate(value: Any) → Model¶ with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶ Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'E...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
1f2fea10ccf9-13
Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exception_type – A tuple of exception types to retry on wait_exponential_jitter – Whether to add jitter to the wait time between retries stop_after_attempt – The maximum number of attempts to make before giving up Returns A new ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.beam.Beam.html
b0652f76899c-0
langchain.llms.cohere.completion_with_retry¶ langchain.llms.cohere.completion_with_retry(llm: Cohere, **kwargs: Any) → Any[source]¶ Use tenacity to retry the completion call.
lang/api.python.langchain.com/en/latest/llms/langchain.llms.cohere.completion_with_retry.html
2087e80acaa0-0
langchain.llms.amazon_api_gateway.AmazonAPIGateway¶ class langchain.llms.amazon_api_gateway.AmazonAPIGateway[source]¶ Bases: LLM Amazon API Gateway to access LLM models hosted on AWS. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parse...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-1
Check Cache and run the LLM on the given prompt and input. async abatch(inputs: List[Union[PromptValue, str, List[BaseMessage]]], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Any) → List[str]¶ Default implementation runs ainvoke in parallel using as...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-2
need more output from the model than just the top generated value, are building chains that are agnostic to the underlying language modeltype (e.g., pure text completion models vs chat models). Parameters prompts – List of PromptValues. A PromptValue is an object that can be converted to match the format of any languag...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-3
**kwargs – Arbitrary additional keyword arguments. These are usually passed to the model provider API call. Returns Top model prediction as a string. async apredict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶ Asynchronously pass messages to the model and ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-4
This includes all inner runs of LLMs, Retrievers, Tools, etc. Output is streamed as Log objects, which include a list of jsonpatch ops that describe how the state of the run has changed in each step, and the final state of the run. The jsonpatch ops can be applied in order to construct state. async atransform(input: As...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-5
Returns A pydantic model that can be used to validate config. configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶ configurable_fields(**kwargs: Union[ConfigurableField, C...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-6
classmethod from_orm(obj: Any) → Model¶ generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, *, tags: Optional[Union[List[str], List[List[str]]]] = None, metada...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-7
functionality, such as logging or streaming, throughout generation. **kwargs – Arbitrary additional keyword arguments. These are usually passed to the model provider API call. Returns An LLMResult, which contains a list of candidate Generations for each inputprompt and additional model provider-specific output. get_inp...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-8
Get a pydantic model that can be used to validate output to the runnable. Runnables that leverage the configurable_fields and configurable_alternatives methods will have a dynamic output schema that depends on which configuration the runnable is invoked with. This method allows to get an output schema for a specific co...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-9
classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-10
Pass a single string input to the model and return a string prediction. Use this method when passing in raw text. If you want to pass in specifictypes of chat messages, use predict_messages. Parameters text – String input to pass to the model. stop – Stop words to use when generating. Model output is cut off at the fir...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-11
stream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → Iterator[str]¶ Default implementation of stream, which calls invoke. Subclasses should override this method if they support streaming output. to_json() → Union[Seriali...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html
2087e80acaa0-12
fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶ Bind lifecycle listeners to a Runnable, returning a new Runnable. on_start: Called before the runnable starts running, with the Run ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.amazon_api_gateway.AmazonAPIGateway.html