langchain.utilities.scenexplain.SceneXplainAPIWrapper¶

class langchain.utilities.scenexplain.SceneXplainAPIWrapper(_env_file: Optional[Union[str, PathLike, List[Union[str, PathLike]], Tuple[Union[str, PathLike], ...]]] = '<object object>', _env_file_encoding: Optional[str] = None, _env_nested_delimiter: Optional[str] = None, _secrets_dir: Optional[Union[str, PathLike]] = None, *, scenex_api_key: str, scenex_api_url: str = 'https://api.scenex.jina.ai/v1/describe')[source]¶

Bases: BaseSettings, BaseModel

Wrapper for SceneXplain API.

In order to set this up, you need API key for the SceneXplain API. You can obtain a key by following the steps below. - Sign up for a free account at https://scenex.jina.ai/. - Navigate to the API Access page (https://scenex.jina.ai/api)

and create a new API key.

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 scenex_api_key: str [Required]¶
param scenex_api_url: str = 'https://api.scenex.jina.ai/v1/describe'¶
run(image: str) str[source]¶

Run SceneXplain image explainer.

validator validate_environment  »  all fields[source]¶

Validate that api key exists in environment.

model Config¶

Bases: BaseConfig

getter_dict¶

alias of GetterDict

classmethod customise_sources(init_settings: Callable[[BaseSettings], Dict[str, Any]], env_settings: Callable[[BaseSettings], Dict[str, Any]], file_secret_settings: Callable[[BaseSettings], Dict[str, Any]]) Tuple[Callable[[BaseSettings], Dict[str, Any]], ...]¶
classmethod get_field_info(name: unicode) Dict[str, Any]¶

Get properties of FieldInfo from the fields property of the config class.

json_dumps(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw)¶

Serialize obj to a JSON formatted str.

If skipkeys is true then dict keys that are not basic types (str, int, float, bool, None) will be skipped instead of raising a TypeError.

If ensure_ascii is false, then the return value can contain non-ASCII characters if they appear in strings contained in obj. Otherwise, all such characters are escaped in JSON strings.

If check_circular is false, then the circular reference check for container types will be skipped and a circular reference will result in an RecursionError (or worse).

If allow_nan is false, then it will be a ValueError to serialize out of range float values (nan, inf, -inf) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (NaN, Infinity, -Infinity).

If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.

If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if indent is None and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace.

default(obj) is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError.

If sort_keys is true (default: False), then the output of dictionaries will be sorted by key.

To use a custom JSONEncoder subclass (e.g. one that overrides the .default() method to serialize additional types), specify it with the cls kwarg; otherwise JSONEncoder is used.

json_loads(*, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)¶

Deserialize s (a str, bytes or bytearray instance containing a JSON document) to a Python object.

object_hook is an optional function that will be called with the result of any object literal decode (a dict). The return value of object_hook will be used instead of the dict. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting).

object_pairs_hook is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of object_pairs_hook will be used instead of the dict. This feature can be used to implement custom decoders. If object_hook is also defined, the object_pairs_hook takes priority.

parse_float, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal).

parse_int, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float).

parse_constant, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered.

To use a custom JSONDecoder subclass, specify it with the cls kwarg; otherwise JSONDecoder is used.

classmethod parse_env_var(field_name: unicode, raw_val: unicode) Any¶
classmethod prepare_field(field: ModelField) None¶

Optional hook to check or modify fields during model creation.

alias_generator = None¶
allow_inf_nan = True¶
allow_mutation = True¶
allow_population_by_field_name = False¶
anystr_lower = False¶
anystr_strip_whitespace = False¶
anystr_upper = False¶
arbitrary_types_allowed = True¶
case_sensitive = False¶
copy_on_model_validation = 'shallow'¶
env_file = None¶
env_file_encoding = None¶
env_nested_delimiter = None¶
env_prefix = ''¶
error_msg_templates = {}¶
extra = 'forbid'¶
fields = {}¶
frozen = False¶
json_encoders = {}¶
keep_untouched = ()¶
max_anystr_length = None¶
min_anystr_length = 0¶
orm_mode = False¶
post_init_call = 'before_validation'¶
schema_extra = {}¶
secrets_dir = None¶
smart_union = False¶
title = None¶
underscore_attrs_are_private = False¶
use_enum_values = False¶
validate_all = True¶
validate_assignment = False¶