id stringlengths 14 15 | text stringlengths 44 2.47k | source stringlengths 61 181 |
|---|---|---|
41f25dc1fdc2-5 | format_messages(**kwargs: Any) → List[BaseMessage][source]¶
Format kwargs into a list of messages.
Parameters
**kwargs – keyword arguments to use for filling in templates in messages.
Returns
A list of formatted messages with all template variables filled in.
format_prompt(**kwargs: Any) → PromptValue¶
Format prompt. S... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.few_shot.FewShotChatMessagePromptTemplate.html |
41f25dc1fdc2-6 | The unique identifier is a list of strings that describes the path
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, encod... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.few_shot.FewShotChatMessagePromptTemplate.html |
41f25dc1fdc2-7 | 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.
Subclasses should override this method if they can start producing... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.few_shot.FewShotChatMessagePromptTemplate.html |
41f25dc1fdc2-8 | A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property output_schema: Type[pydantic.main.BaseModel]¶
Examples using FewShotChatMessagePromptTemplate¶
Few-shot examples for chat models | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.few_shot.FewShotChatMessagePromptTemplate.html |
faf9b4674acb-0 | langchain.prompts.loading.load_prompt¶
langchain.prompts.loading.load_prompt(path: Union[str, Path]) → BasePromptTemplate[source]¶
Unified method for loading a prompt from LangChainHub or local fs.
Examples using load_prompt¶
Amazon Comprehend Moderation Chain
Serialization | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.loading.load_prompt.html |
a80c4834e883-0 | langchain.prompts.chat.ChatPromptValueConcrete¶
class langchain.prompts.chat.ChatPromptValueConcrete[source]¶
Bases: ChatPromptValue
Chat prompt value which explicitly lists out the message types it accepts.
For use in external schemas.
Create a new model by parsing and validating input data from keyword arguments.
Rai... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatPromptValueConcrete.html |
a80c4834e883-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... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatPromptValueConcrete.html |
a80c4834e883-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... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatPromptValueConcrete.html |
5df6c12d4bc9-0 | langchain.prompts.prompt.PromptTemplate¶
class langchain.prompts.prompt.PromptTemplate[source]¶
Bases: StringPromptTemplate
A prompt template for a language model.
A prompt template consists of a string template. It accepts a set of parameters
from the user that can be used to generate a prompt for a language model.
Th... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.prompt.PromptTemplate.html |
5df6c12d4bc9-1 | Default implementation of abatch, which calls ainvoke N times.
Subclasses should override this method if they can batch more efficiently.
async ainvoke(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any) → Output¶
Default implementation of ainvoke, which calls invoke in a thread pool.
Subclasses shoul... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.prompt.PromptTemplate.html |
5df6c12d4bc9-2 | input is still being generated.
batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶
Default implementation of batch, which calls invoke N times.
Subclasses should override this method if they can ba... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.prompt.PromptTemplate.html |
5df6c12d4bc9-3 | kwargs – Any arguments to be passed to the prompt template.
Returns
A formatted string.
Example
prompt.format(variable1="foo")
format_prompt(**kwargs: Any) → PromptValue¶
Create Chat Messages.
classmethod from_examples(examples: List[str], suffix: str, input_variables: List[str], example_separator: str = '\n\n', prefix... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.prompt.PromptTemplate.html |
5df6c12d4bc9-4 | template_format – The format of the template. Use jinja2 for jinja2,
and f-string or None for f-strings.
partial_variables –
A dictionary of variables that can be used to partiallyfill in the template. For example, if the template is
”{variable1} {variable2}”, and partial_variables is
{“variable1”: “foo”}, then the fi... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.prompt.PromptTemplate.html |
5df6c12d4bc9-5 | The unique identifier is a list of strings that describes the path
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, encod... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.prompt.PromptTemplate.html |
5df6c12d4bc9-6 | 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.
Subclasses should override this method if they can start producing... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.prompt.PromptTemplate.html |
5df6c12d4bc9-7 | A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property output_schema: Type[pydantic.main.BaseModel]¶
Examples using PromptTemplate¶
RePhraseQueryRetriever
Zapier Natural Language Actions
Dall-E Image Generator
Streamlit Chat Message History
Context
Argilla
Comet
Aim... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.prompt.PromptTemplate.html |
5df6c12d4bc9-8 | Template formats
Connecting to a Feature Store
Router
Transformation
Custom chain
Async API
First we add a step to load memory
Configure Runnable traces | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.prompt.PromptTemplate.html |
86339da54bb4-0 | langchain.prompts.loading.load_prompt_from_config¶
langchain.prompts.loading.load_prompt_from_config(config: dict) → BasePromptTemplate[source]¶
Load prompt from Config Dict. | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.loading.load_prompt_from_config.html |
e6d5a64801f6-0 | langchain.prompts.chat.BaseChatPromptTemplate¶
class langchain.prompts.chat.BaseChatPromptTemplate[source]¶
Bases: BasePromptTemplate, ABC
Base class for chat prompt templates.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to fo... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseChatPromptTemplate.html |
e6d5a64801f6-1 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseChatPromptTemplate.html |
e6d5a64801f6-2 | Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
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, exclu... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseChatPromptTemplate.html |
e6d5a64801f6-3 | Get the namespace of the langchain object.
For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
invoke(input: Dict, config: langchain.schema.runnable.config.RunnableConfig | None = None) → PromptValue¶
classmethod is_lc_serializable() → bool¶
Return whether th... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseChatPromptTemplate.html |
e6d5a64801f6-4 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
partial(**kwargs: Union[str, Callable[[], str]]) → BasePromptTemplate¶
Return a partial of the prompt template.
s... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseChatPromptTemplate.html |
e6d5a64801f6-5 | 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: ~typing.Sequence[~langchain.schema.runnable.base.Runnable[~langchain.schema.runnable.utils.Input, ~langc... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseChatPromptTemplate.html |
dca8375920b1-0 | langchain.prompts.chat.BaseStringMessagePromptTemplate¶
class langchain.prompts.chat.BaseStringMessagePromptTemplate[source]¶
Bases: BaseMessagePromptTemplate, ABC
Base class for message prompt templates that use a string prompt template.
Create a new model by parsing and validating input data from keyword arguments.
R... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseStringMessagePromptTemplate.html |
dca8375920b1-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... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseStringMessagePromptTemplate.html |
dca8375920b1-2 | A new instance of this class.
classmethod get_lc_namespace() → List[str]¶
Get the namespace of the langchain object.
For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
classmethod is_lc_serializable() → bool¶
Return whether or not the class is serializable.
... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseStringMessagePromptTemplate.html |
dca8375920b1-3 | classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to upda... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseStringMessagePromptTemplate.html |
d1397704eebb-0 | langchain.prompts.base.jinja2_formatter¶
langchain.prompts.base.jinja2_formatter(template: str, **kwargs: Any) → str[source]¶
Format a template using jinja2. | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.base.jinja2_formatter.html |
0632bb0cee2a-0 | langchain.prompts.base.StringPromptValue¶
class langchain.prompts.base.StringPromptValue[source]¶
Bases: PromptValue
String prompt value.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param text: str [Requ... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.base.StringPromptValue.html |
0632bb0cee2a-1 | Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
classmethod from_orm(obj: Any) → Model¶
classmethod get_lc_namespace() → List[str]¶
Get the namespace of the langchain object.
For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“l... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.base.StringPromptValue.html |
0632bb0cee2a-2 | classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_impl... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.base.StringPromptValue.html |
ee93fa4cee5e-0 | langchain.prompts.chat.ChatMessagePromptTemplate¶
class langchain.prompts.chat.ChatMessagePromptTemplate[source]¶
Bases: BaseStringMessagePromptTemplate
Chat message prompt template.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatMessagePromptTemplate.html |
ee93fa4cee5e-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... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatMessagePromptTemplate.html |
ee93fa4cee5e-2 | Get the namespace of the langchain object.
For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
classmethod is_lc_serializable() → bool¶
Return whether or not the class is serializable.
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = No... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatMessagePromptTemplate.html |
ee93fa4cee5e-3 | classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to upda... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatMessagePromptTemplate.html |
7fcc86dee299-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.InMemoryCache.html |
d1a2bbcfb87f-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[,... | https://api.python.langchain.com/en/latest/cache/langchain.cache.SQLAlchemyCache.html |
d8758f3a315b-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.GPTCache.html |
d8758f3a315b-1 | import gptcache
from gptcache.processor.pre import get_prompt
from gptcache.manager.factory import get_data_manager
# Avoid multiple caches using the same file,
causing different llm model caches to affect each other
def init_gptcache(cache_obj: gptcache.Cache, llm str):
cache_obj.init(pre_embedding_func=get_prompt,
da... | https://api.python.langchain.com/en/latest/cache/langchain.cache.GPTCache.html |
d24fbfebbd2e-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.RedisCache.html |
d24fbfebbd2e-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]][... | https://api.python.langchain.com/en/latest/cache/langchain.cache.RedisCache.html |
10f40d1a0721-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.RedisSemanticCache.html |
10f40d1a0721-1 | 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(prompt: str, llm_string: str, return_val: Sequence[Generation]) → None[source]¶
U... | https://api.python.langchain.com/en/latest/cache/langchain.cache.RedisSemanticCache.html |
a46bc1c81c90-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.CassandraCache.html |
a46bc1c81c90-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_... | https://api.python.langchain.com/en/latest/cache/langchain.cache.CassandraCache.html |
2a1e07824c6e-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.SQLiteCache.html |
6210f83d65cc-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.CassandraSemanticCache.html |
6210f83d65cc-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 ... | https://api.python.langchain.com/en/latest/cache/langchain.cache.CassandraSemanticCache.html |
6210f83d65cc-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.CassandraSemanticCache.html |
6210f83d65cc-3 | Update cache based on prompt and llm_string. | https://api.python.langchain.com/en/latest/cache/langchain.cache.CassandraSemanticCache.html |
f9c3b236e7e0-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.MomentoCache.html |
f9c3b236e7e0-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.MomentoCache.html |
f9c3b236e7e0-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.MomentoCache.html |
e0445f337b3f-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... | https://api.python.langchain.com/en/latest/cache/langchain.cache.FullLLMCache.html |
3437d975b4ad-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 Neo4jGra... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.nebula_graph.NebulaGraph.html |
24f880469eff-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Node.html |
24f880469eff-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Node.html |
24f880469eff-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Node.html |
6a0e866d12cd-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.
Create a new Memgraph graph wrapper instance.
Methods
__init__(url, username, password, *[, database])... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.memgraph_graph.MemgraphGraph.html |
46616342a80e-0 | langchain.graphs.arangodb_graph.ArangoGraph¶
class langchain.graphs.arangodb_graph.ArangoGraph(db: Any)[source]¶
ArangoDB wrapper for graph operations.
Create a new ArangoDB graph wrapper instance.
Attributes
db
schema
Methods
__init__(db)
Create a new ArangoDB graph wrapper instance.
from_db_credentials([url, dbname, ... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.arangodb_graph.ArangoGraph.html |
46616342a80e-1 | ARANGODB_PASSWORD. Defaults to “”.
Returns
An arango.database.StandardDatabase.
generate_schema(sample_ratio: float = 0) → Dict[str, List[Dict[str, Any]]][source]¶
Generates the schema of the ArangoDB Database and returns it
User can specify a sample_ratio (0 to 1) to determine the
ratio of documents/edges used (in rel... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.arangodb_graph.ArangoGraph.html |
89c2130cb380-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
Create a new HugeGraph wrapper instance.
Attributes
get_schema
Re... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.hugegraph.HugeGraph.html |
04ef6f46fc3b-0 | langchain.graphs.falkordb_graph.FalkorDBGraph¶
class langchain.graphs.falkordb_graph.FalkorDBGraph(database: str, host: str = 'localhost', port: int = 6379)[source]¶
FalkorDB wrapper for graph operations.
Create a new FalkorDB graph wrapper instance.
Attributes
get_schema
Returns the schema of the FalkorDB database
get... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.falkordb_graph.FalkorDBGraph.html |
890ebcd87eb9-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Relationship.html |
890ebcd87eb9-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Relationship.html |
890ebcd87eb9-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.Relationship.html |
b23798ef4eff-0 | langchain.graphs.rdf_graph.RdfGraph¶
class langchain.graphs.rdf_graph.RdfGraph(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: Optional[str] = None)[source]¶
RDFlib wrapper ... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.rdf_graph.RdfGraph.html |
b23798ef4eff-1 | serialization – serialization of the input
query_endpoint – SPARQL endpoint for queries, read access
update_endpoint – SPARQL endpoint for UPDATE queries, write access
standard – RDF, RDFS, or OWL
local_copy – new local copy for storing changes
load_schema() → None[source]¶
Load the graph schema information.
query(quer... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.rdf_graph.RdfGraph.html |
c442127a23ba-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')[source]¶
Neptune wrapper for graph oper... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.neptune_graph.NeptuneGraph.html |
07d2a83b70f7-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 ... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.arangodb_graph.get_arangodb_client.html |
f1ba2a705544-0 | langchain.graphs.networkx_graph.get_entities¶
langchain.graphs.networkx_graph.get_entities(entity_str: str) → List[str][source]¶
Extract entities from entity string. | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.get_entities.html |
aba7e90a7e4d-0 | langchain.graphs.kuzu_graph.KuzuGraph¶
class langchain.graphs.kuzu_graph.KuzuGraph(db: Any, database: str = 'kuzu')[source]¶
Kùzu wrapper for graph operations.
Attributes
get_schema
Returns the schema of the Kùzu database
Methods
__init__(db[, database])
query(query[, params])
Query Kùzu database
refresh_schema()
Refre... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.kuzu_graph.KuzuGraph.html |
e99eab59ec81-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.GraphDocument.html |
e99eab59ec81-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.GraphDocument.html |
e99eab59ec81-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.graph_document.GraphDocument.html |
8dc45de6b32e-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 | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.neptune_graph.NeptuneQueryException.html |
7c884a831c90-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. | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.parse_triples.html |
c69bc6608a78-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... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.KnowledgeTriple.html |
c517cee5a6ce-0 | langchain.graphs.networkx_graph.NetworkxEntityGraph¶
class langchain.graphs.networkx_graph.NetworkxEntityGraph(graph: Optional[Any] = None)[source]¶
Networkx wrapper for entity graph operations.
Create a new graph.
Methods
__init__([graph])
Create a new graph.
add_triple(knowledge_triple)
Add a triple to the graph.
cle... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.NetworkxEntityGraph.html |
c517cee5a6ce-1 | Get information about an entity.
get_topological_sort() → List[str][source]¶
Get a list of entity names in the graph sorted by causal dependence.
get_triples() → List[Tuple[str, str, str]][source]¶
Get all triples in the graph.
write_to_gml(path: str) → None[source]¶
Examples using NetworkxEntityGraph¶
Graph QA | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.networkx_graph.NetworkxEntityGraph.html |
2626a4b6a79e-0 | langchain.graphs.neo4j_graph.Neo4jGraph¶
class langchain.graphs.neo4j_graph.Neo4jGraph(url: str, username: str, password: str, database: str = 'neo4j')[source]¶
Neo4j wrapper for graph operations.
Create a new Neo4j graph wrapper instance.
Methods
__init__(url, username, password[, database])
Create a new Neo4j graph w... | https://api.python.langchain.com/en/latest/graphs/langchain.graphs.neo4j_graph.Neo4jGraph.html |
9f69e83e6a58-0 | langchain.agents.output_parsers.xml.XMLAgentOutputParser¶
class langchain.agents.output_parsers.xml.XMLAgentOutputParser[source]¶
Bases: AgentOutputParser
Parses tool invocations and final answers in XML format.
Expects output to be in one of two formats.
If the output signals that an action should be taken,
should be ... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html |
9f69e83e6a58-1 | Parameters
text – String output of a language model.
Returns
Structured output.
async aparse_result(result: List[Generation], *, partial: bool = False) → T¶
Parse a list of candidate model Generations into a specific format.
The return value is parsed from only the first Generation in the result, whichis assumed to be ... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html |
9f69e83e6a58-2 | 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[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html |
9f69e83e6a58-3 | Return dictionary representation of output parser.
classmethod from_orm(obj: Any) → Model¶
get_format_instructions() → str[source]¶
Instructions on how the LLM output should be formatted.
classmethod get_lc_namespace() → List[str]¶
Get the namespace of the langchain object.
For example, if the class is langchain.llms.o... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html |
9f69e83e6a58-4 | Parse text into agent action/finish.
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: Union[str, bytes], *, content_type: unicode = No... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html |
9f69e83e6a58-5 | Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
transform(input: Iterator[Input], config: Optional[RunnableConfig] = No... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html |
9f69e83e6a58-6 | 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]¶ | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.xml.XMLAgentOutputParser.html |
fb28cb1b4e1f-0 | langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser¶
class langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser[source]¶
Bases: AgentOutputParser
Parses ReAct-style LLM calls that have a single tool input in json format.
Expects output to be in on... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
fb28cb1b4e1f-1 | Default implementation of ainvoke, which calls invoke in a thread pool.
Subclasses should override this method if they can run asynchronously.
async aparse(text: str) → T¶
Parse a single string model output into some structure.
Parameters
text – String output of a language model.
Returns
Structured output.
async aparse... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
fb28cb1b4e1f-2 | step, and the final state of the run.
The jsonpatch ops can be applied in order to construct state.
async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶
Default implementation of atransform, which buffers input and calls astream.
Subcla... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
fb28cb1b4e1f-3 | 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(**kwargs: Any) → Dict¶
Return dictionary representation of output parser.
classmethod from_orm(obj: Any) → Model¶
get_format_instructions() → str[source]¶
Instructions on how the LLM output shou... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
fb28cb1b4e1f-4 | Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with each input.
parse(text: str) → Union[AgentAction, AgentFinish][source]¶
Parse text into agent action/finish.
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: ... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
fb28cb1b4e1f-5 | stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implem... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
fb28cb1b4e1f-6 | property lc_attributes: Dict¶
List of attribute names that should be included in the serialized kwargs.
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: T... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_json_single_input.ReActJsonSingleInputOutputParser.html |
0d62d0a95e0b-0 | langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser¶
class langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser[source]¶
Bases: AgentOutputParser
Parses ReAct-style LLM calls that have a single tool input.
Expects output to be in one of two formats.
If the output s... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html |
0d62d0a95e0b-1 | Parameters
text – String output of a language model.
Returns
Structured output.
async aparse_result(result: List[Generation], *, partial: bool = False) → T¶
Parse a list of candidate model Generations into a specific format.
The return value is parsed from only the first Generation in the result, whichis assumed to be ... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html |
0d62d0a95e0b-2 | 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[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html |
0d62d0a95e0b-3 | Return dictionary representation of output parser.
classmethod from_orm(obj: Any) → Model¶
get_format_instructions() → str[source]¶
Instructions on how the LLM output should be formatted.
classmethod get_lc_namespace() → List[str]¶
Get the namespace of the langchain object.
For example, if the class is langchain.llms.o... | https://api.python.langchain.com/en/latest/agents.output_parsers/langchain.agents.output_parsers.react_single_input.ReActSingleInputOutputParser.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.