id stringlengths 14 15 | text stringlengths 44 2.47k | source stringlengths 61 181 |
|---|---|---|
65c06c828b68-12 | 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... | https://api.python.langchain.com/en/latest/tot/langchain_experimental.tot.thought_generation.BaseThoughtGenerationStrategy.html |
65c06c828b68-13 | 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/tot/langchain_experimental.tot.thought_generation.BaseThoughtGenerationStrategy.html |
9f6eaa40c5f4-0 | langchain_experimental.tot.thought.ThoughtValidity¶
class langchain_experimental.tot.thought.ThoughtValidity(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
VALID_INTERMEDIATE = 0¶
VALID_FINAL = 1¶
INVALID = 2¶ | https://api.python.langchain.com/en/latest/tot/langchain_experimental.tot.thought.ThoughtValidity.html |
26b8e0209162-0 | langchain.utils.html.extract_sub_links¶
langchain.utils.html.extract_sub_links(raw_html: str, url: str, *, base_url: Optional[str] = None, pattern: Optional[Union[str, Pattern]] = None, prevent_outside: bool = True, exclude_prefixes: Sequence[str] = ()) → List[str][source]¶
Extract all links from a raw html string and ... | https://api.python.langchain.com/en/latest/utils/langchain.utils.html.extract_sub_links.html |
f18caeee60c4-0 | langchain.utils.input.print_text¶
langchain.utils.input.print_text(text: str, color: Optional[str] = None, end: str = '', file: Optional[TextIO] = None) → None[source]¶
Print text with highlighting and no end characters. | https://api.python.langchain.com/en/latest/utils/langchain.utils.input.print_text.html |
76275577ba77-0 | langchain.utils.openai_functions.convert_pydantic_to_openai_function¶
langchain.utils.openai_functions.convert_pydantic_to_openai_function(model: Type[BaseModel], *, name: Optional[str] = None, description: Optional[str] = None) → FunctionDescription[source]¶ | https://api.python.langchain.com/en/latest/utils/langchain.utils.openai_functions.convert_pydantic_to_openai_function.html |
ae66d5049b08-0 | langchain.utils.utils.build_extra_kwargs¶
langchain.utils.utils.build_extra_kwargs(extra_kwargs: Dict[str, Any], values: Dict[str, Any], all_required_field_names: Set[str]) → Dict[str, Any][source]¶
Build extra kwargs from values and extra_kwargs.
Parameters
extra_kwargs – Extra kwargs passed in by user.
values – Value... | https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.build_extra_kwargs.html |
bc11c8b8f4c8-0 | langchain.utils.input.get_colored_text¶
langchain.utils.input.get_colored_text(text: str, color: str) → str[source]¶
Get colored text. | https://api.python.langchain.com/en/latest/utils/langchain.utils.input.get_colored_text.html |
36acc3fc66e7-0 | langchain.utils.math.cosine_similarity¶
langchain.utils.math.cosine_similarity(X: Union[List[List[float]], List[ndarray], ndarray], Y: Union[List[List[float]], List[ndarray], ndarray]) → ndarray[source]¶
Row-wise cosine similarity between two equal-width matrices. | https://api.python.langchain.com/en/latest/utils/langchain.utils.math.cosine_similarity.html |
5e16417fb5df-0 | langchain.utils.env.get_from_env¶
langchain.utils.env.get_from_env(key: str, env_key: str, default: Optional[str] = None) → str[source]¶
Get a value from a dictionary or an environment variable. | https://api.python.langchain.com/en/latest/utils/langchain.utils.env.get_from_env.html |
10041ca2bd50-0 | langchain.utils.aiter.Tee¶
class langchain.utils.aiter.Tee(iterable: AsyncIterator[T], n: int = 2, *, lock: Optional[AsyncContextManager[Any]] = None)[source]¶
Create n separate asynchronous iterators over iterable
This splits a single iterable into multiple iterators, each providing
the same items in the same order.
A... | https://api.python.langchain.com/en/latest/utils/langchain.utils.aiter.Tee.html |
10041ca2bd50-1 | and access is automatically synchronised.
Methods
__init__(iterable[, n, lock])
aclose()
__init__(iterable: AsyncIterator[T], n: int = 2, *, lock: Optional[AsyncContextManager[Any]] = None)[source]¶
async aclose() → None[source]¶ | https://api.python.langchain.com/en/latest/utils/langchain.utils.aiter.Tee.html |
05a68171bcc2-0 | langchain.utils.strings.stringify_dict¶
langchain.utils.strings.stringify_dict(data: dict) → str[source]¶
Stringify a dictionary.
Parameters
data – The dictionary to stringify.
Returns
The stringified dictionary.
Return type
str | https://api.python.langchain.com/en/latest/utils/langchain.utils.strings.stringify_dict.html |
3e4c13091c85-0 | langchain.utils.iter.safetee¶
langchain.utils.iter.safetee¶
alias of Tee | https://api.python.langchain.com/en/latest/utils/langchain.utils.iter.safetee.html |
71e73152b9cb-0 | langchain.utils.utils.check_package_version¶
langchain.utils.utils.check_package_version(package: str, lt_version: Optional[str] = None, lte_version: Optional[str] = None, gt_version: Optional[str] = None, gte_version: Optional[str] = None) → None[source]¶
Check the version of a package. | https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.check_package_version.html |
e28841c14b38-0 | langchain.utils.utils.get_pydantic_field_names¶
langchain.utils.utils.get_pydantic_field_names(pydantic_cls: Any) → Set[str][source]¶
Get field names, including aliases, for a pydantic class.
Parameters
pydantic_cls – Pydantic class. | https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.get_pydantic_field_names.html |
22ab57349470-0 | langchain.utils.utils.guard_import¶
langchain.utils.utils.guard_import(module_name: str, *, pip_name: Optional[str] = None, package: Optional[str] = None) → Any[source]¶
Dynamically imports a module and raises a helpful exception if the module is not
installed. | https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.guard_import.html |
631f120d33a9-0 | langchain.utils.iter.NoLock¶
class langchain.utils.iter.NoLock[source]¶
Dummy lock that provides the proper interface but no protection
Methods
__init__()
__init__()¶ | https://api.python.langchain.com/en/latest/utils/langchain.utils.iter.NoLock.html |
36f82e444dd5-0 | langchain.utils.pydantic.get_pydantic_major_version¶
langchain.utils.pydantic.get_pydantic_major_version() → int[source]¶
Get the major version of Pydantic. | https://api.python.langchain.com/en/latest/utils/langchain.utils.pydantic.get_pydantic_major_version.html |
74de23c31359-0 | langchain.utils.aiter.py_anext¶
langchain.utils.aiter.py_anext(iterator: ~typing.AsyncIterator[~langchain.utils.aiter.T], default: ~typing.Union[~langchain.utils.aiter.T, ~typing.Any] = <object object>) → Awaitable[Union[T, None, Any]][source]¶
Pure-Python implementation of anext() for testing purposes.
Closely matches... | https://api.python.langchain.com/en/latest/utils/langchain.utils.aiter.py_anext.html |
29b99192acae-0 | langchain.utils.strings.stringify_value¶
langchain.utils.strings.stringify_value(val: Any) → str[source]¶
Stringify a value.
Parameters
val – The value to stringify.
Returns
The stringified value.
Return type
str | https://api.python.langchain.com/en/latest/utils/langchain.utils.strings.stringify_value.html |
1e3825d6e57b-0 | langchain.utils.input.get_color_mapping¶
langchain.utils.input.get_color_mapping(items: List[str], excluded_colors: Optional[List] = None) → Dict[str, str][source]¶
Get mapping for items to a support color. | https://api.python.langchain.com/en/latest/utils/langchain.utils.input.get_color_mapping.html |
f3036d4c5ca9-0 | langchain.utils.loading.try_load_from_hub¶
langchain.utils.loading.try_load_from_hub(path: Union[str, Path], loader: Callable[[str], T], valid_prefix: str, valid_suffixes: Set[str], **kwargs: Any) → Optional[T][source]¶
Load configuration from hub. Returns None if path is not a hub path. | https://api.python.langchain.com/en/latest/utils/langchain.utils.loading.try_load_from_hub.html |
bdb97c5874c9-0 | langchain.utils.html.find_all_links¶
langchain.utils.html.find_all_links(raw_html: str, *, pattern: Optional[Union[str, Pattern]] = None) → List[str][source]¶ | https://api.python.langchain.com/en/latest/utils/langchain.utils.html.find_all_links.html |
142acb9d4180-0 | langchain.utils.iter.batch_iterate¶
langchain.utils.iter.batch_iterate(size: int, iterable: Iterable[T]) → Iterator[List[T]][source]¶
Utility batching function. | https://api.python.langchain.com/en/latest/utils/langchain.utils.iter.batch_iterate.html |
f9e9b05688d0-0 | langchain.utils.env.get_from_dict_or_env¶
langchain.utils.env.get_from_dict_or_env(data: Dict[str, Any], key: str, env_key: str, default: Optional[str] = None) → str[source]¶
Get a value from a dictionary or an environment variable. | https://api.python.langchain.com/en/latest/utils/langchain.utils.env.get_from_dict_or_env.html |
0ffb3318446d-0 | langchain.utils.utils.raise_for_status_with_text¶
langchain.utils.utils.raise_for_status_with_text(response: Response) → None[source]¶
Raise an error with the response text. | https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.raise_for_status_with_text.html |
e9b8ffef0e5a-0 | langchain.utils.math.cosine_similarity_top_k¶
langchain.utils.math.cosine_similarity_top_k(X: Union[List[List[float]], List[ndarray], ndarray], Y: Union[List[List[float]], List[ndarray], ndarray], top_k: Optional[int] = 5, score_threshold: Optional[float] = None) → Tuple[List[Tuple[int, int]], List[float]][source]¶
Row... | https://api.python.langchain.com/en/latest/utils/langchain.utils.math.cosine_similarity_top_k.html |
f10172df4100-0 | langchain.utils.utils.mock_now¶
langchain.utils.utils.mock_now(dt_value)[source]¶
Context manager for mocking out datetime.now() in unit tests.
Example:
with mock_now(datetime.datetime(2011, 2, 3, 10, 11)):
assert datetime.datetime.now() == datetime.datetime(2011, 2, 3, 10, 11) | https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.mock_now.html |
6003fc863a61-0 | langchain.utils.input.get_bolded_text¶
langchain.utils.input.get_bolded_text(text: str) → str[source]¶
Get bolded text. | https://api.python.langchain.com/en/latest/utils/langchain.utils.input.get_bolded_text.html |
513a53a344b2-0 | langchain.utils.openai_functions.FunctionDescription¶
class langchain.utils.openai_functions.FunctionDescription[source]¶
Representation of a callable function to the OpenAI API.
name: str¶
The name of the function.
description: str¶
A description of the function.
parameters: dict¶
The parameters of the function. | https://api.python.langchain.com/en/latest/utils/langchain.utils.openai_functions.FunctionDescription.html |
1a63105a6ebd-0 | langchain.utils.formatting.StrictFormatter¶
class langchain.utils.formatting.StrictFormatter[source]¶
A subclass of formatter that checks for extra keys.
Methods
__init__()
check_unused_args(used_args, args, kwargs)
Check to see if extra parameters are passed.
convert_field(value, conversion)
format(format_string, /, *... | https://api.python.langchain.com/en/latest/utils/langchain.utils.formatting.StrictFormatter.html |
dad9559f22ac-0 | langchain.utils.aiter.atee¶
langchain.utils.aiter.atee¶
alias of Tee | https://api.python.langchain.com/en/latest/utils/langchain.utils.aiter.atee.html |
b3803d78f080-0 | langchain.utils.iter.Tee¶
class langchain.utils.iter.Tee(iterable: Iterator[T], n: int = 2, *, lock: Optional[ContextManager[Any]] = None)[source]¶
Create n separate asynchronous iterators over iterable
This splits a single iterable into multiple iterators, each providing
the same items in the same order.
All child ite... | https://api.python.langchain.com/en/latest/utils/langchain.utils.iter.Tee.html |
b3803d78f080-1 | and access is automatically synchronised.
Methods
__init__(iterable[, n, lock])
close()
__init__(iterable: Iterator[T], n: int = 2, *, lock: Optional[ContextManager[Any]] = None)[source]¶
close() → None[source]¶ | https://api.python.langchain.com/en/latest/utils/langchain.utils.iter.Tee.html |
5339d67e778e-0 | langchain.utils.strings.comma_list¶
langchain.utils.strings.comma_list(items: List[Any]) → str[source]¶
Convert a list to a comma-separated string. | https://api.python.langchain.com/en/latest/utils/langchain.utils.strings.comma_list.html |
293ccf418149-0 | langchain.utils.aiter.tee_peer¶
async langchain.utils.aiter.tee_peer(iterator: AsyncIterator[T], buffer: Deque[T], peers: List[Deque[T]], lock: AsyncContextManager[Any]) → AsyncGenerator[T, None][source]¶
An individual iterator of a tee() | https://api.python.langchain.com/en/latest/utils/langchain.utils.aiter.tee_peer.html |
d5e4dc02afcf-0 | langchain.utils.iter.tee_peer¶
langchain.utils.iter.tee_peer(iterator: Iterator[T], buffer: Deque[T], peers: List[Deque[T]], lock: ContextManager[Any]) → Generator[T, None, None][source]¶
An individual iterator of a tee() | https://api.python.langchain.com/en/latest/utils/langchain.utils.iter.tee_peer.html |
635dec18067f-0 | langchain.utils.aiter.NoLock¶
class langchain.utils.aiter.NoLock[source]¶
Dummy lock that provides the proper interface but no protection
Methods
__init__()
__init__()¶ | https://api.python.langchain.com/en/latest/utils/langchain.utils.aiter.NoLock.html |
7589af1ffb0e-0 | langchain.utils.utils.xor_args¶
langchain.utils.utils.xor_args(*arg_groups: Tuple[str, ...]) → Callable[source]¶
Validate specified keyword args are mutually exclusive. | https://api.python.langchain.com/en/latest/utils/langchain.utils.utils.xor_args.html |
0cbe8de47ed9-0 | langchain.utils.json_schema.dereference_refs¶
langchain.utils.json_schema.dereference_refs(schema_obj: dict, *, full_schema: Optional[dict] = None, skip_keys: Optional[Sequence[str]] = None) → dict[source]¶
Try to substitute $refs in JSON Schema. | https://api.python.langchain.com/en/latest/utils/langchain.utils.json_schema.dereference_refs.html |
ecaadef2fb4e-0 | langchain_experimental.fallacy_removal.base.FallacyChain¶
class langchain_experimental.fallacy_removal.base.FallacyChain[source]¶
Bases: Chain
Chain for applying logical fallacy evaluations, modeled after Constitutional AI and in same format, but applying logical fallacies as generalized rules to remove in outp... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-1 | Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
param chain: LLMChain [Required]¶
param fallacy_critique_chain: LLMChain [Required]¶
param fallacy_revision_chain: LLMChain [Required]¶
param logical_fallacies: List[LogicalFallacy] [Required]¶
param memory: Optional[... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-2 | will be printed to the console. Defaults to langchain.verbose value.
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-3 | Default implementation of abatch, which calls ainvoke N times.
Subclasses should override this method if they can batch more efficiently.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optiona... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-4 | Default implementation of ainvoke, which calls invoke in a thread pool.
Subclasses should override this method if they can run asynchronously.
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Call the chain on all inputs i... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-5 | # Suppose we have a multi-input chain that takes a 'question' string
# and 'context' string:
question = "What's the temperature in Boise, Idaho?"
context = "Weather report for Boise, Idaho on 07/03/23..."
await chain.arun(question=question, context=context)
# -> "The temperature in Boise is..."
async astream(input: Inp... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-6 | 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/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-7 | **kwargs – Keyword arguments passed to default pydantic.BaseModel.dict
method.
Returns
A dictionary representation of the chain.
Example
chain.dict(exclude_unset=True)
# -> {"_type": "foo", "verbose": False, ...} | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-8 | classmethod from_llm(llm: BaseLanguageModel, chain: LLMChain, fallacy_critique_prompt: BasePromptTemplate = FewShotPromptTemplate(input_variables=['input_prompt', 'output_from_model', 'fallacy_critique_request'], examples=[{'input_prompt': "If everyone says the Earth is round, how do I know that's correct?", 'o... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-9 | Also point out potential logical fallacies in the human’s questions and responses. Examples of logical fallacies include but are not limited to ad homimem, ad populum, appeal to emotion and false causality.', 'fallacy_critique': 'This answer commits the division fallacy by reject... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-10 | 'output_from_model', 'fallacy_critique_request', 'fallacy_critique', 'fallacy_revision_request'], examples=[{'input_prompt': "If everyone says the Earth is round, how do I know that's correct?", 'output_from_model': 'The earth is round because your teacher says it is', 'fallacy_critique_request': 'Ident... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-11 | previous response had a logical fallacy. Also point out potential logical fallacies in the human’s questions and responses. Examples of logical fallacies include but are not limited to ad homimem, ad populum, appeal to emotion and false causality.', 'fallacy_critique': 'This answ... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-12 | changing, please revise the model response based on the Fallacy Revision Request.\n\nFallacy Revision Request: {fallacy_revision_request}\n\nFallacy Revision:', example_separator='\n === \n', prefix='Below is a conversation between a human and an AI assistant.'), **kwargs: Any) → FallacyChain[source]¶ | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-13 | Create a chain from an LLM.
classmethod from_orm(obj: Any) → Model¶
classmethod get_fallacies(names: Optional[List[str]] = None) → List[LogicalFallacy][source]¶
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
name... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-14 | 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 = 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/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-15 | The main difference between this method and Chain.__call__ is that this
method expects inputs to be passed directly in as positional arguments or
keyword arguments, whereas Chain.__call__ expects a single input dictionary
with all the inputs
Parameters
*args – If the chain expects a single input, it can be passed in as... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-16 | classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Default implementation of stream, which calls invoke.
Subclasses should override t... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
ecaadef2fb4e-17 | property InputType: Type[langchain.schema.runnable.utils.Input]¶
property OutputType: Type[langchain.schema.runnable.utils.Output]¶
property input_keys: List[str]¶
Input keys.
property input_schema: Type[pydantic.main.BaseModel]¶
property lc_attributes: Dict¶
List of attribute names that should be included in the seria... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.base.FallacyChain.html |
141c1883baf6-0 | langchain_experimental.fallacy_removal.models.LogicalFallacy¶
class langchain_experimental.fallacy_removal.models.LogicalFallacy[source]¶
Bases: BaseModel
Class for a logical fallacy.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parse... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.models.LogicalFallacy.html |
141c1883baf6-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/fallacy_removal/langchain_experimental.fallacy_removal.models.LogicalFallacy.html |
141c1883baf6-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¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on... | https://api.python.langchain.com/en/latest/fallacy_removal/langchain_experimental.fallacy_removal.models.LogicalFallacy.html |
048e1476971f-0 | langchain.embeddings.clarifai.ClarifaiEmbeddings¶
class langchain.embeddings.clarifai.ClarifaiEmbeddings[source]¶
Bases: BaseModel, Embeddings
Clarifai embedding models.
To use, you should have the clarifai python package installed, and the
environment variable CLARIFAI_PAT set with your personal access token or pass i... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.clarifai.ClarifaiEmbeddings.html |
048e1476971f-1 | 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/embeddings/langchain.embeddings.clarifai.ClarifaiEmbeddings.html |
048e1476971f-2 | Call out to Clarifai’s embedding models.
Parameters
text – The text to embed.
Returns
Embeddings for the text.
classmethod from_orm(obj: Any) → Model¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = Fals... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.clarifai.ClarifaiEmbeddings.html |
048e1476971f-3 | classmethod validate(value: Any) → Model¶
Examples using ClarifaiEmbeddings¶
Clarifai | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.clarifai.ClarifaiEmbeddings.html |
b6846c6f9c7f-0 | langchain.embeddings.aleph_alpha.AlephAlphaAsymmetricSemanticEmbedding¶
class langchain.embeddings.aleph_alpha.AlephAlphaAsymmetricSemanticEmbedding[source]¶
Bases: BaseModel, Embeddings
Aleph Alpha’s asymmetric semantic embedding.
AA provides you with an endpoint to embed a document and a query.
The models were optimi... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.aleph_alpha.AlephAlphaAsymmetricSemanticEmbedding.html |
b6846c6f9c7f-1 | in processing your request in our
own datacenters and on servers hosted with other providers.
Choose this option for maximal availability.
Setting it to “aleph-alpha” allows us to only process the request
in our own datacenters.
Choose this option for maximal data privacy.
param model: str = 'luminous-base'¶
Model name... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.aleph_alpha.AlephAlphaAsymmetricSemanticEmbedding.html |
b6846c6f9c7f-2 | 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... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.aleph_alpha.AlephAlphaAsymmetricSemanticEmbedding.html |
b6846c6f9c7f-3 | :param text: The text to embed.
Returns
Embeddings for the text.
classmethod from_orm(obj: Any) → Model¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclu... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.aleph_alpha.AlephAlphaAsymmetricSemanticEmbedding.html |
a06df5d9d5bc-0 | langchain.embeddings.octoai_embeddings.OctoAIEmbeddings¶
class langchain.embeddings.octoai_embeddings.OctoAIEmbeddings[source]¶
Bases: BaseModel, Embeddings
OctoAI Compute Service embedding models.
The environment variable OCTOAI_API_TOKEN should be set
with your API token, or it can be passed
as a named parameter to t... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.octoai_embeddings.OctoAIEmbeddings.html |
a06df5d9d5bc-1 | 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] = None, deep: bool = False) → Model¶
Duplicate a model, optionally... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.octoai_embeddings.OctoAIEmbeddings.html |
a06df5d9d5bc-2 | classmethod from_orm(obj: Any) → Model¶
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_defaults: bool = False, exclude_n... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.octoai_embeddings.OctoAIEmbeddings.html |
6aacc1985a10-0 | langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings¶
class langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings[source]¶
Bases: BaseModel, Embeddings
TensorflowHub embedding models.
To use, you should have the tensorflow_text python package installed.
Example
from langchain.embeddings import TensorflowHu... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings.html |
6aacc1985a10-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/embeddings/langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings.html |
6aacc1985a10-2 | 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 = None, encoding: unicode = 'utf8', proto... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings.html |
ea9ff509aff9-0 | langchain.embeddings.sagemaker_endpoint.SagemakerEndpointEmbeddings¶
class langchain.embeddings.sagemaker_endpoint.SagemakerEndpointEmbeddings[source]¶
Bases: BaseModel, Embeddings
Custom Sagemaker Inference Endpoints.
To use, you must supply the endpoint name from your deployed
Sagemaker model & the region where it is... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.sagemaker_endpoint.SagemakerEndpointEmbeddings.html |
ea9ff509aff9-1 | function. See `boto3`_. docs for more info.
.. _boto3: <https://boto3.amazonaws.com/v1/documentation/api/latest/index.html>
param endpoint_name: str = ''¶
The name of the endpoint from the deployed Sagemaker model.
Must be unique within an AWS Region.
param model_kwargs: Optional[Dict] = None¶
Key word arguments to pas... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.sagemaker_endpoint.SagemakerEndpointEmbeddings.html |
ea9ff509aff9-2 | 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/embeddings/langchain.embeddings.sagemaker_endpoint.SagemakerEndpointEmbeddings.html |
ea9ff509aff9-3 | 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().
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.sagemaker_endpoint.SagemakerEndpointEmbeddings.html |
f2b3dbd586a8-0 | langchain.embeddings.localai.LocalAIEmbeddings¶
class langchain.embeddings.localai.LocalAIEmbeddings[source]¶
Bases: BaseModel, Embeddings
LocalAI embedding models.
Since LocalAI and OpenAI have 1:1 compatibility between APIs, this class
uses the openai Python package’s openai.Embedding as its client.
Thus, you should ... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.localai.LocalAIEmbeddings.html |
f2b3dbd586a8-1 | param openai_api_base: Optional[str] = None¶
param openai_api_key: Optional[str] = None¶
param openai_api_version: Optional[str] = None¶
param openai_organization: Optional[str] = None¶
param openai_proxy: Optional[str] = None¶
param request_timeout: Optional[Union[float, Tuple[float, float]]] = None¶
Timeout in second... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.localai.LocalAIEmbeddings.html |
f2b3dbd586a8-2 | Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include – fields to include in new model
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 creat... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.localai.LocalAIEmbeddings.html |
f2b3dbd586a8-3 | Embedding for the text.
classmethod from_orm(obj: Any) → Model¶
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_defaults:... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.localai.LocalAIEmbeddings.html |
e22a174dad9f-0 | langchain.embeddings.localai.async_embed_with_retry¶
async langchain.embeddings.localai.async_embed_with_retry(embeddings: LocalAIEmbeddings, **kwargs: Any) → Any[source]¶
Use tenacity to retry the embedding call. | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.localai.async_embed_with_retry.html |
3cc9252c0a54-0 | langchain.embeddings.dashscope.DashScopeEmbeddings¶
class langchain.embeddings.dashscope.DashScopeEmbeddings[source]¶
Bases: BaseModel, Embeddings
DashScope embedding models.
To use, you should have the dashscope python package installed, and the
environment variable DASHSCOPE_API_KEY set with your API key or pass it
a... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.dashscope.DashScopeEmbeddings.html |
3cc9252c0a54-1 | 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... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.dashscope.DashScopeEmbeddings.html |
3cc9252c0a54-2 | Call out to DashScope’s embedding endpoint for embedding query text.
Parameters
text – The text to embed.
Returns
Embedding for the text.
classmethod from_orm(obj: Any) → Model¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = ... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.dashscope.DashScopeEmbeddings.html |
3cc9252c0a54-3 | classmethod validate(value: Any) → Model¶
Examples using DashScopeEmbeddings¶
DashScope
DashVector | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.dashscope.DashScopeEmbeddings.html |
6ca6107ca26e-0 | langchain.embeddings.vertexai.VertexAIEmbeddings¶
class langchain.embeddings.vertexai.VertexAIEmbeddings[source]¶
Bases: _VertexAICommon, Embeddings
Google Cloud VertexAI embedding models.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be ... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.vertexai.VertexAIEmbeddings.html |
6ca6107ca26e-1 | Asynchronous Embed query text.
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
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 ... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.vertexai.VertexAIEmbeddings.html |
6ca6107ca26e-2 | sets a max batch size of 5 strings.
Parameters
texts – List[str] The list of strings to embed.
batch_size – [int] The batch size of embeddings to send to the model
Returns
List of embeddings, one for each text.
embed_query(text: str) → List[float][source]¶
Embed a text.
Parameters
text – The text to embed.
Returns
Embe... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.vertexai.VertexAIEmbeddings.html |
6ca6107ca26e-3 | classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on fields based on this Model, globalns and localns.
classmethod validate(value: Any) → Model¶
property is_... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.vertexai.VertexAIEmbeddings.html |
fb031875d1bb-0 | langchain.embeddings.modelscope_hub.ModelScopeEmbeddings¶
class langchain.embeddings.modelscope_hub.ModelScopeEmbeddings[source]¶
Bases: BaseModel, Embeddings
ModelScopeHub embedding models.
To use, you should have the modelscope python package installed.
Example
from langchain.embeddings import ModelScopeEmbeddings
mo... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.modelscope_hub.ModelScopeEmbeddings.html |
fb031875d1bb-1 | 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(*, i... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.modelscope_hub.ModelScopeEmbeddings.html |
fb031875d1bb-2 | 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().
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.modelscope_hub.ModelScopeEmbeddings.html |
4995e2b1589e-0 | langchain.embeddings.self_hosted_hugging_face.SelfHostedHuggingFaceEmbeddings¶
class langchain.embeddings.self_hosted_hugging_face.SelfHostedHuggingFaceEmbeddings[source]¶
Bases: SelfHostedEmbeddings
HuggingFace embedding models on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS,... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted_hugging_face.SelfHostedHuggingFaceEmbeddings.html |
4995e2b1589e-1 | Model name to use.
param model_load_fn: Callable = <function load_embedding_model>¶
Function to load the model remotely on the server.
param model_reqs: List[str] = ['./', 'sentence_transformers', 'torch']¶
Requirements to install on hardware to inference the model.
param pipeline_ref: Any = None¶
param tags: Optional[... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted_hugging_face.SelfHostedHuggingFaceEmbeddings.html |
4995e2b1589e-2 | Asynchronous Embed query text.
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[List[str], List[List[str]]]] = None, metadata... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted_hugging_face.SelfHostedHuggingFaceEmbeddings.html |
4995e2b1589e-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... | https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted_hugging_face.SelfHostedHuggingFaceEmbeddings.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.