id stringlengths 14 16 | text stringlengths 31 2.41k | source stringlengths 53 121 |
|---|---|---|
a44a60c1f5be-261 | Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-262 | Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]ο
Return the namespace of the langchain object.
eg. [βlangchainβ, βllmsβ, βopenaiβ]
property lc_secrets: Dict[str, str]ο
Return a map of constructor ar... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-263 | callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
tags (Optional[List[str]]) β
model (str) β
input (Dict[str, Any]) β
model_kwargs (Dict[str, Any]) β
replicate_api_token (Optional[str]) β
Return type
None
attribute tags: Optional[List[str]] = Noneο
Tags to add to the run trace.
attribute... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-264 | kwargs (Any) β
Return type
langchain.schema.LLMResult
async apredict(text, *, stop=None, **kwargs)ο
Predict text from text.
Parameters
text (str) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
str
async apredict_messages(messages, *, stop=None, **kwargs)ο
Predict message from messages.
Parameters
mes... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-265 | Returns
new model instance
Return type
Model
dict(**kwargs)ο
Return a dictionary of the LLM.
Parameters
kwargs (Any) β
Return type
Dict
generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameters
prompts (List[str]) β
stop (Optional[List[str]]) β
callba... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-266 | Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-267 | Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]ο
Return the namespace of the langchain object.
eg. [βlangchainβ, βllmsβ, βopenaiβ]
property lc_secrets: Dict[str, str]ο
Return a map of constructor ar... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-268 | callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
tags (Optional[List[str]]) β
client (Any) β
endpoint_name (str) β
region_name (str) β
credentials_profile_name (Optional[str]) β
content_handler (langchain.llms.sagemaker_endpoint.LLMContentHandler) β
model_kwargs (Optional[Dict]) β
end... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-269 | attribute tags: Optional[List[str]] = Noneο
Tags to add to the run trace.
attribute verbose: bool [Optional]ο
Whether to print out response text.
__call__(prompt, stop=None, callbacks=None, **kwargs)ο
Check Cache and run the LLM on the given prompt and input.
Parameters
prompt (str) β
stop (Optional[List[str]]) β
cal... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-270 | kwargs (Any) β
Return type
str
async apredict_messages(messages, *, stop=None, **kwargs)ο
Predict message from messages.
Parameters
messages (List[langchain.schema.BaseMessage]) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
langchain.schema.BaseMessage
classmethod construct(_fields_set=None, **value... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-271 | Run the LLM on the given prompt and input.
Parameters
prompts (List[str]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Optional[List[str]]) β
kwargs (Any) β
Return type
langchain.schema.LLMResult... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-272 | include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (bool) β
exclude_defaults (bool) β
exclude_none (bool) β
encoder (Optional[Callable[[Any], Any]]) β
models_as_dict (b... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-273 | property lc_namespace: List[str]ο
Return the namespace of the langchain object.
eg. [βlangchainβ, βllmsβ, βopenaiβ]
property lc_secrets: Dict[str, str]ο
Return a map of constructor argument names to secret ids.
eg. {βopenai_api_keyβ: βOPENAI_API_KEYβ}
property lc_serializable: boolο
Return whether or not the class is s... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-274 | model_id="google/flan-t5-large", task="text2text-generation",
hardware=gpu
)
Example passing fn that generates a pipeline (bc the pipeline is not serializable):from langchain.llms import SelfHostedHuggingFaceLLM
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import runhouse as rh
def get_pip... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-275 | attribute hardware: Any = Noneο
Remote hardware to send the inference function to.
attribute inference_fn: Callable = <function _generate_text>ο
Inference function to send to the remote hardware.
attribute load_fn_kwargs: Optional[dict] = Noneο
Key word arguments to pass to the model load function.
attribute model_id: ... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-276 | Parameters
prompts (List[str]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Optional[List[str]]) β
kwargs (Any) β
Return type
langchain.schema.LLMResult
async agenerate_prompt(prompts, stop=None,... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-277 | Model
copy(*, include=None, exclude=None, update=None, deep=False)ο
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) ... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-278 | kwargs (Any) β
Return type
langchain.schema.LLMResult
generate_prompt(prompts, stop=None, callbacks=None, **kwargs)ο
Take in a list of prompt values and return an LLMResult.
Parameters
prompts (List[langchain.schema.PromptValue]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-279 | exclude_defaults (bool) β
exclude_none (bool) β
encoder (Optional[Callable[[Any], Any]]) β
models_as_dict (bool) β
dumps_kwargs (Any) β
Return type
unicode
predict(text, *, stop=None, **kwargs)ο
Predict text from text.
Parameters
text (str) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
str
predi... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-280 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.llms.SelfHostedPipeline(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, pipeline_ref=None, client=None, inference_fn=<function _generate_text>, hardware=None, model_load_fn, load_fn_kwargs=Non... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-281 | import runhouse as rh
gpu = rh.cluster(name="rh-a10x", instance_type="A100:1")
my_model = ...
llm = SelfHostedPipeline.from_pipeline(
pipeline=my_model,
hardware=gpu,
model_reqs=["./", "torch", "transformers"],
)
Example passing model path for larger models:from langchain.llms import SelfHostedPipeline
impo... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-282 | Key word arguments to pass to the model load function.
attribute model_load_fn: Callable [Required]ο
Function to load the model remotely on the server.
attribute model_reqs: List[str] = ['./', 'torch']ο
Requirements to install on hardware to inference the model.
attribute tags: Optional[List[str]] = Noneο
Tags to add t... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-283 | kwargs (Any) β
Return type
langchain.schema.LLMResult
async apredict(text, *, stop=None, **kwargs)ο
Predict text from text.
Parameters
text (str) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
str
async apredict_messages(messages, *, stop=None, **kwargs)ο
Predict message from messages.
Parameters
mes... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-284 | Returns
new model instance
Return type
Model
dict(**kwargs)ο
Return a dictionary of the LLM.
Parameters
kwargs (Any) β
Return type
Dict
classmethod from_pipeline(pipeline, hardware, model_reqs=None, device=0, **kwargs)[source]ο
Init the SelfHostedPipeline from a pipeline object or string.
Parameters
pipeline (Any) β
... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-285 | Get the number of tokens in the message.
Parameters
messages (List[langchain.schema.BaseMessage]) β
Return type
int
get_token_ids(text)ο
Get the token present in the text.
Parameters
text (str) β
Return type
List[int]
json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-286 | save(file_path)ο
Save the LLM.
Parameters
file_path (Union[pathlib.Path, str]) β Path to file to save the LLM to.
Return type
None
Example:
.. code-block:: python
llm.save(file_path=βpath/llm.yamlβ)
classmethod update_forward_refs(**localns)ο
Try to update ForwardRefs on fields based on this Model, globalns and localns... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-287 | 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]]) β
api_url (str) β
model_kwargs... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-288 | kwargs (Any) β
Return type
langchain.schema.LLMResult
async agenerate_prompt(prompts, stop=None, callbacks=None, **kwargs)ο
Take in a list of prompt values and return an LLMResult.
Parameters
prompts (List[langchain.schema.PromptValue]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callback... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-289 | exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) β 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 (bool... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-290 | Get the number of tokens in the message.
Parameters
messages (List[langchain.schema.BaseMessage]) β
Return type
int
get_token_ids(text)ο
Get the token present in the text.
Parameters
text (str) β
Return type
List[int]
json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-291 | save(file_path)ο
Save the LLM.
Parameters
file_path (Union[pathlib.Path, str]) β Path to file to save the LLM to.
Return type
None
Example:
.. code-block:: python
llm.save(file_path=βpath/llm.yamlβ)
classmethod update_forward_refs(**localns)ο
Try to update ForwardRefs on fields based on this Model, globalns and localns... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-292 | 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]]) β
client (_LanguageModel) β
mo... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-293 | Sampling temperature, it controls the degree of randomness in token selection.
attribute top_k: int = 40ο
How the model selects tokens for output, the next token is selected from
attribute top_p: float = 0.95ο
Tokens are selected from most probable to least until the sum of their
attribute tuned_model_name: Optional[st... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-294 | kwargs (Any) β
Return type
langchain.schema.LLMResult
async apredict(text, *, stop=None, **kwargs)ο
Predict text from text.
Parameters
text (str) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
str
async apredict_messages(messages, *, stop=None, **kwargs)ο
Predict message from messages.
Parameters
mes... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-295 | Returns
new model instance
Return type
Model
dict(**kwargs)ο
Return a dictionary of the LLM.
Parameters
kwargs (Any) β
Return type
Dict
generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameters
prompts (List[str]) β
stop (Optional[List[str]]) β
callba... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-296 | Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-297 | Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]ο
Return the namespace of the langchain object.
eg. [βlangchainβ, βllmsβ, βopenaiβ]
property lc_secrets: Dict[str, str]ο
Return a map of constructor ar... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-298 | max_tokens (Optional[int]) β
temperature (Optional[float]) β
top_p (Optional[float]) β
stop (Optional[List[str]]) β
presence_penalty (Optional[float]) β
repetition_penalty (Optional[float]) β
best_of (Optional[int]) β
logprobs (bool) β
n (Optional[int]) β
writer_api_key (Optional[str]) β
base_url (Optional[st... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-299 | attribute verbose: bool [Optional]ο
Whether to print out response text.
attribute writer_api_key: Optional[str] = Noneο
Writer API key.
attribute writer_org_id: Optional[str] = Noneο
Writer organization ID.
__call__(prompt, stop=None, callbacks=None, **kwargs)ο
Check Cache and run the LLM on the given prompt and input.... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-300 | stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
str
async apredict_messages(messages, *, stop=None, **kwargs)ο
Predict message from messages.
Parameters
messages (List[langchain.schema.BaseMessage]) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
langchain.schema.BaseMessage
classmethod c... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-301 | generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameters
prompts (List[str]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
tags (Optional... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-302 | Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (bool) β
exclude_defaults (bool) β
exclude_none (bool) β
encoder (Optional[Callable[[Any], Any]]) β
models... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-303 | property lc_namespace: List[str]ο
Return the namespace of the langchain object.
eg. [βlangchainβ, βllmsβ, βopenaiβ]
property lc_secrets: Dict[str, str]ο
Return a map of constructor argument names to secret ids.
eg. {βopenai_api_keyβ: βOPENAI_API_KEYβ}
property lc_serializable: boolο
Return whether or not the class is s... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-304 | )
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]]) β
endpoint_url (Optional[str]... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-305 | tags (Optional[List[str]]) β
kwargs (Any) β
Return type
langchain.schema.LLMResult
async agenerate_prompt(prompts, stop=None, callbacks=None, **kwargs)ο
Take in a list of prompt values and return an LLMResult.
Parameters
prompts (List[langchain.schema.PromptValue]) β
stop (Optional[List[str]]) β
callbacks (Optional... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-306 | exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) β 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 (bool... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-307 | Get the number of tokens in the message.
Parameters
messages (List[langchain.schema.BaseMessage]) β
Return type
int
get_token_ids(text)ο
Get the token present in the text.
Parameters
text (str) β
Return type
List[int]
json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude... | https://api.python.langchain.com/en/stable/modules/llms.html |
a44a60c1f5be-308 | save(file_path)ο
Save the LLM.
Parameters
file_path (Union[pathlib.Path, str]) β Path to file to save the LLM to.
Return type
None
Example:
.. code-block:: python
llm.save(file_path=βpath/llm.yamlβ)
classmethod update_forward_refs(**localns)ο
Try to update ForwardRefs on fields based on this Model, globalns and localns... | https://api.python.langchain.com/en/stable/modules/llms.html |
1ed571763b88-0 | Retrieversο
class langchain.retrievers.AmazonKendraRetriever(index_id, region_name=None, credentials_profile_name=None, top_k=3, attribute_filter=None, client=None)[source]ο
Bases: langchain.schema.BaseRetriever
Retriever class to query documents from Amazon Kendra Index.
Parameters
index_id (str) β Kendra index id
reg... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-1 | Parameters
query (str) β string to find relevant documents for
Returns
List of relevant documents
Return type
List[langchain.schema.Document]
class langchain.retrievers.ArxivRetriever(*, arxiv_search=None, arxiv_exceptions=None, top_k_results=3, load_max_docs=100, load_all_available_meta=False, doc_content_chars_max=40... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-2 | Bases: langchain.schema.BaseRetriever, pydantic.main.BaseModel
Wrapper around Azure Cognitive Search.
Parameters
service_name (str) β
index_name (str) β
api_key (str) β
api_version (str) β
aiosession (Optional[aiohttp.client.ClientSession]) β
content_key (str) β
Return type
None
attribute aiosession: Optional[aio... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-3 | Bases: langchain.schema.BaseRetriever, pydantic.main.BaseModel
Parameters
url (str) β
bearer_token (str) β
top_k (int) β
filter (Optional[dict]) β
aiosession (Optional[aiohttp.client.ClientSession]) β
Return type
None
attribute aiosession: Optional[aiohttp.client.ClientSession] = Noneο
attribute bearer_token: str ... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-4 | attribute base_retriever: langchain.schema.BaseRetriever [Required]ο
Base Retriever to use for getting relevant documents.
async aget_relevant_documents(query)[source]ο
Get documents relevant for a query.
Parameters
query (str) β string to find relevant documents for
Returns
List of relevant documents
Return type
List[... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-5 | Wrapper around Elasticsearch using BM25 as a retrieval method.
To connect to an Elasticsearch instance that requires login credentials,
including Elastic Cloud, use the Elasticsearch URL format
https://username:password@es_host:9243. For example, to connect to Elastic
Cloud, create the Elasticsearch URL with the requir... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-6 | refresh_indices (bool) β bool to refresh ElasticSearch indices
Returns
List of ids from adding the texts into the retriever.
Return type
List[str]
get_relevant_documents(query)[source]ο
Get documents relevant for a query.
Parameters
query (str) β string to find relevant documents for
Returns
List of relevant documents
... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-7 | Parameters
texts (List[str]) β
embeddings (langchain.embeddings.base.Embeddings) β
kwargs (Any) β
Return type
langchain.retrievers.knn.KNNRetriever
get_relevant_documents(query)[source]ο
Get documents relevant for a query.
Parameters
query (str) β string to find relevant documents for
Returns
List of relevant docume... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-8 | Return type
None
attribute index: Any = Noneο
attribute query_kwargs: Dict [Optional]ο
async aget_relevant_documents(query)[source]ο
Get documents relevant for a query.
Parameters
query (str) β string to find relevant documents for
Returns
List of relevant documents
Return type
List[langchain.schema.Document]
get_relev... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-9 | Returns
A list of merged documents.
Return type
List[langchain.schema.Document]
class langchain.retrievers.MetalRetriever(client, params=None)[source]ο
Bases: langchain.schema.BaseRetriever
Retriever that uses the Metal API.
Parameters
client (Any) β
params (Optional[dict]) β
get_relevant_documents(query)[source]ο
Ge... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-10 | Parameters
query (str) β string to find relevant documents for
Returns
List of relevant documents
Return type
List[langchain.schema.Document]
async aget_relevant_documents(query)[source]ο
Get documents relevant for a query.
Parameters
query (str) β string to find relevant documents for
Returns
List of relevant document... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-11 | retriever (langchain.schema.BaseRetriever) β retriever to query documents from
llm (langchain.llms.base.BaseLLM) β llm for query generation using DEFAULT_QUERY_PROMPT
prompt (langchain.prompts.prompt.PromptTemplate) β
parser_key (str) β
Returns
MultiQueryRetriever
Return type
langchain.retrievers.multi_query.MultiQue... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-12 | Bases: langchain.schema.BaseRetriever, pydantic.main.BaseModel
Parameters
embeddings (langchain.embeddings.base.Embeddings) β
sparse_encoder (Any) β
index (Any) β
top_k (int) β
alpha (float) β
Return type
None
attribute alpha: float = 0.5ο
attribute embeddings: langchain.embeddings.base.Embeddings [Required]ο
attr... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-13 | Returns
List of relevant documents
Return type
List[langchain.schema.Document]
class langchain.retrievers.PubMedRetriever(*, top_k_results=3, load_max_docs=25, doc_content_chars_max=2000, load_all_available_meta=False, email='your_email@example.com', base_url_esearch='https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esear... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-14 | Returns
List of relevant documents
Return type
List[langchain.schema.Document]
class langchain.retrievers.RemoteLangChainRetriever(*, url, headers=None, input_key='message', response_key='response', page_content_key='page_content', metadata_key='metadata')[source]ο
Bases: langchain.schema.BaseRetriever, pydantic.main.B... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-15 | index (Any) β
texts (List[str]) β
k (int) β
relevancy_threshold (Optional[float]) β
Return type
None
attribute embeddings: langchain.embeddings.base.Embeddings [Required]ο
attribute index: Any = Noneο
attribute k: int = 4ο
attribute relevancy_threshold: Optional[float] = Noneο
attribute texts: List[str] [Required]ο... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-16 | search_type (str) β
search_kwargs (dict) β
structured_query_translator (langchain.chains.query_constructor.ir.Visitor) β
verbose (bool) β
use_original_query (bool) β
Return type
None
attribute llm_chain: langchain.chains.llm.LLMChain [Required]ο
The LLMChain for generating the vector store queries.
attribute searc... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-17 | metadata_field_info (List[langchain.chains.query_constructor.schema.AttributeInfo]) β
structured_query_translator (Optional[langchain.chains.query_constructor.ir.Visitor]) β
chain_kwargs (Optional[Dict]) β
enable_limit (bool) β
use_original_query (bool) β
kwargs (Any) β
Return type
langchain.retrievers.self_query... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-18 | Parameters
documents (Iterable[langchain.schema.Document]) β
tfidf_params (Optional[Dict[str, Any]]) β
kwargs (Any) β
Return type
langchain.retrievers.tfidf.TFIDFRetriever
classmethod from_texts(texts, metadatas=None, tfidf_params=None, **kwargs)[source]ο
Parameters
texts (Iterable[str]) β
metadatas (Optional[Itera... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-19 | attribute default_salience: Optional[float] = Noneο
The salience to assign memories not retrieved from the vector store.
None assigns no salience to documents not fetched from the vector store.
attribute k: int = 4ο
The maximum number of documents to retrieve in a given call.
attribute memory_stream: List[langchain.sch... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-20 | Parameters
query (str) β
Return type
Dict[int, Tuple[langchain.schema.Document, float]]
class langchain.retrievers.VespaRetriever(app, body, content_field, metadata_fields=None)[source]ο
Bases: langchain.schema.BaseRetriever
Retriever that uses the Vespa.
Parameters
app (Vespa) β
body (Dict) β
content_field (str) β ... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-21 | from. Defaults to None.
_filter (Optional[str]) β Document filter condition expressed in YQL.
Defaults to None.
yql (Optional[str]) β Full YQL query to be used. Should not be specified
if _filter or sources are specified. Defaults to None.
kwargs (Any) β Keyword arguments added to query body.
Return type
langchain.retr... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-22 | Parameters
query (str) β string to find relevant documents for
where_filter (Optional[Dict[str, object]]) β
Returns
List of relevant documents
Return type
List[langchain.schema.Document]
class langchain.retrievers.WikipediaRetriever(*, wiki_client=None, top_k_results=3, lang='en', load_all_available_meta=False, doc_co... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-23 | More on Zep:
Zep provides long-term conversation storage for LLM apps. The server stores,
summarizes, embeds, indexes, and enriches conversational AI chat
histories, and exposes them via simple, low-latency APIs.
For server installation instructions, see:
https://getzep.github.io/deployment/quickstart/
Parameters
sessi... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-24 | Add text to the Zilliz store
Parameters
texts (List[str]) β The text
metadatas (List[dict]) β Metadata dicts, must line up with existing store
Return type
None
get_relevant_documents(query)[source]ο
Get documents relevant for a query.
Parameters
query (str) β string to find relevant documents for
Returns
List of releva... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-25 | Should be an embedding/vector/tensor.
content_fieldο
Field that represents the main content in your document schema.
Will be used as a page_content. Everything else will go into metadata.
search_typeο
Type of search to perform (similarity / mmr)
filtersο
Filters applied for document retrieval.
top_kο
Number of document... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-26 | Return type
None
attribute transformers: List[Union[langchain.schema.BaseDocumentTransformer, langchain.retrievers.document_compressors.base.BaseDocumentCompressor]] [Required]ο
List of document filters that are chained together and run in sequence.
async acompress_documents(documents, query)[source]ο
Compress retrieve... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-27 | indicate greater similarity.
attribute similarity_threshold: Optional[float] = Noneο
Threshold for determining when two documents are similar enough
to be considered redundant. Defaults to None, must be specified if k is set
to None.
async acompress_documents(documents, query)[source]ο
Filter down documents.
Parameters... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-28 | Compress page content of raw documents.
Parameters
documents (Sequence[langchain.schema.Document]) β
query (str) β
Return type
Sequence[langchain.schema.Document]
classmethod from_llm(llm, prompt=None, get_input=None, llm_chain_kwargs=None)[source]ο
Initialize from LLM.
Parameters
llm (langchain.base_language.BaseLan... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
1ed571763b88-29 | query (str) β
Return type
Sequence[langchain.schema.Document]
compress_documents(documents, query)[source]ο
Filter down documents based on their relevance to the query.
Parameters
documents (Sequence[langchain.schema.Document]) β
query (str) β
Return type
Sequence[langchain.schema.Document]
classmethod from_llm(llm,... | https://api.python.langchain.com/en/stable/modules/retrievers.html |
3a705d435744-0 | Example Selectorο
Logic for selecting examples to include in prompts.
class langchain.prompts.example_selector.LengthBasedExampleSelector(*, examples, example_prompt, get_text_length=<function _get_length_based>, max_length=2048, example_text_lengths=[])[source]ο
Bases: langchain.prompts.example_selector.base.BaseExamp... | https://api.python.langchain.com/en/stable/modules/example_selector.html |
3a705d435744-1 | Bases: langchain.prompts.example_selector.semantic_similarity.SemanticSimilarityExampleSelector
ExampleSelector that selects examples based on Max Marginal Relevance.
This was shown to improve performance in this paper:
https://arxiv.org/pdf/2211.13892.pdf
Parameters
vectorstore (langchain.vectorstores.base.VectorStore... | https://api.python.langchain.com/en/stable/modules/example_selector.html |
3a705d435744-2 | Parameters
input_variables (Dict[str, str]) β
Return type
List[dict]
class langchain.prompts.example_selector.NGramOverlapExampleSelector(*, examples, example_prompt, threshold=- 1.0)[source]ο
Bases: langchain.prompts.example_selector.base.BaseExampleSelector, pydantic.main.BaseModel
Select and order examples based on... | https://api.python.langchain.com/en/stable/modules/example_selector.html |
3a705d435744-3 | Excludes any examples with ngram_overlap_score less than or equal to threshold.
Parameters
input_variables (Dict[str, str]) β
Return type
List[dict]
class langchain.prompts.example_selector.SemanticSimilarityExampleSelector(*, vectorstore, k=4, example_keys=None, input_keys=None)[source]ο
Bases: langchain.prompts.exam... | https://api.python.langchain.com/en/stable/modules/example_selector.html |
3a705d435744-4 | vectorstore_cls (Type[langchain.vectorstores.base.VectorStore]) β A vector store DB interface class, e.g. FAISS.
k (int) β Number of examples to select
input_keys (Optional[List[str]]) β If provided, the search is based on the input variables
instead of all variables.
vectorstore_cls_kwargs (Any) β optional kwargs cont... | https://api.python.langchain.com/en/stable/modules/example_selector.html |
af8b1c7c6518-0 | Callbacksο
Callback handlers that allow listening to events in LangChain.
class langchain.callbacks.AimCallbackHandler(repo=None, experiment_name=None, system_tracking_interval=10, log_system_params=True)[source]ο
Bases: langchain.callbacks.aim_callback.BaseMetadataCallbackHandler, langchain.callbacks.base.BaseCallback... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-1 | Return type
None
on_llm_new_token(token, **kwargs)[source]ο
Run when LLM generates a new token.
Parameters
token (str) β
kwargs (Any) β
Return type
None
on_llm_error(error, **kwargs)[source]ο
Run when LLM errors.
Parameters
error (Union[Exception, KeyboardInterrupt]) β
kwargs (Any) β
Return type
None
on_chain_start... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-2 | Return type
None
on_text(text, **kwargs)[source]ο
Run when agent is ending.
Parameters
text (str) β
kwargs (Any) β
Return type
None
on_agent_finish(finish, **kwargs)[source]ο
Run when agent ends running.
Parameters
finish (langchain.schema.AgentFinish) β
kwargs (Any) β
Return type
None
on_agent_action(action, **kwa... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-3 | Bases: langchain.callbacks.base.BaseCallbackHandler
Callback Handler that logs into Argilla.
Parameters
dataset_name (str) β name of the FeedbackDataset in Argilla. Note that it must
exist in advance. If you need help on how to create a FeedbackDataset in
Argilla, please visit
https://docs.argilla.io/en/latest/guides/l... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-4 | ... callbacks=[argilla_callback],
... verbose=True,
... openai_api_key="API_KEY_HERE",
... )
>>> llm.generate([
... "What is the best NLP-annotation tool out there? (no bias at all)",
... ])
"Argilla, no doubt about it."
on_llm_start(serialized, prompts, **kwargs)[source]ο
Save the prompts in memory whe... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-5 | kwargs (Any) β
Return type
None
on_chain_end(outputs, **kwargs)[source]ο
If either the parent_run_id or the run_id is in self.prompts, then
log the outputs to Argilla, and pop the run from self.prompts. The behavior
differs if the output is a list or not.
Parameters
outputs (Dict[str, Any]) β
kwargs (Any) β
Return t... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-6 | Do nothing
Parameters
text (str) β
kwargs (Any) β
Return type
None
on_agent_finish(finish, **kwargs)[source]ο
Do nothing
Parameters
finish (langchain.schema.AgentFinish) β
kwargs (Any) β
Return type
None
class langchain.callbacks.ArizeCallbackHandler(model_id=None, model_version=None, SPACE_KEY=None, API_KEY=None)[... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-7 | inputs (Dict[str, Any]) β
kwargs (Any) β
Return type
None
on_chain_end(outputs, **kwargs)[source]ο
Do nothing.
Parameters
outputs (Dict[str, Any]) β
kwargs (Any) β
Return type
None
on_chain_error(error, **kwargs)[source]ο
Do nothing.
Parameters
error (Union[Exception, KeyboardInterrupt]) β
kwargs (Any) β
Return t... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-8 | kwargs (Any) β
Return type
None
class langchain.callbacks.AsyncIteratorCallbackHandler[source]ο
Bases: langchain.callbacks.base.AsyncCallbackHandler
Callback handler that returns an async iterator.
Return type
None
property always_verbose: boolο
queue: asyncio.queues.Queue[str]ο
done: asyncio.locks.Eventο
async on_llm... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-9 | Callback Handler that logs to ClearML.
Parameters
job_type (str) β The type of clearml task such as βinferenceβ, βtestingβ or βqcβ
project_name (str) β The clearml project name
tags (list) β Tags to add to the task
task_name (str) β Name of the clearml task
visualize (bool) β Whether to visualize the run.
complexity_me... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-10 | kwargs (Any) β
Return type
None
on_chain_start(serialized, inputs, **kwargs)[source]ο
Run when chain starts running.
Parameters
serialized (Dict[str, Any]) β
inputs (Dict[str, Any]) β
kwargs (Any) β
Return type
None
on_chain_end(outputs, **kwargs)[source]ο
Run when chain ends running.
Parameters
outputs (Dict[str, ... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-11 | Return type
None
on_agent_action(action, **kwargs)[source]ο
Run on agent action.
Parameters
action (langchain.schema.AgentAction) β
kwargs (Any) β
Return type
Any
analyze_text(text)[source]ο
Analyze text using textstat and spacy.
Parameters
text (str) β The text to analyze.
Returns
A dictionary containing the complex... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-12 | workspace (Optional[str]) β
name (Optional[str]) β
visualizations (Optional[List[str]]) β
custom_metrics (Optional[Callable]) β
Return type
None
This handler will utilize the associated callback method and formats
the input of each callback function with metadata regarding the state of LLM run,
and adds the respons... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-13 | kwargs (Any) β
Return type
None
on_chain_error(error, **kwargs)[source]ο
Run when chain errors.
Parameters
error (Union[Exception, KeyboardInterrupt]) β
kwargs (Any) β
Return type
None
on_tool_start(serialized, input_str, **kwargs)[source]ο
Run when tool starts running.
Parameters
serialized (Dict[str, Any]) β
inpu... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-14 | Flush the tracker and setup the session.
Everything after this will be a new table.
Parameters
name (Optional[str]) β Name of the preformed session so far so it is identifyable
langchain_asset (Any) β The langchain asset to save.
finish (bool) β Whether to finish the run.
Returns β None
task_type (Optional[str]) β
wor... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-15 | color (Optional[str]) β
kwargs (Any) β
Return type
Any
on_tool_end(output, color=None, observation_prefix=None, llm_prefix=None, **kwargs)[source]ο
If not the final action, print out observation.
Parameters
output (str) β
color (Optional[str]) β
observation_prefix (Optional[str]) β
llm_prefix (Optional[str]) β
kw... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
af8b1c7c6518-16 | Run when LLM starts running.
Parameters
serialized (Dict[str, Any]) β
prompts (List[str]) β
kwargs (Any) β
Return type
None
on_llm_new_token(token, **kwargs)[source]ο
Run on new LLM token. Only available when streaming is enabled.
Parameters
token (str) β
kwargs (Any) β
Return type
None
class langchain.callbacks.H... | https://api.python.langchain.com/en/stable/modules/callbacks.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.