id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
95552857791c-6
langchain.document_loaders.dropbox langchain.document_loaders.duckdb_loader langchain.document_loaders.email langchain.document_loaders.embaas langchain.document_loaders.epub langchain.document_loaders.etherscan langchain.document_loaders.evernote langchain.document_loaders.excel langchain.document_loaders.facebook_cha...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-7
langchain.document_loaders.notion langchain.document_loaders.notiondb langchain.document_loaders.nuclia langchain.document_loaders.obs_directory langchain.document_loaders.obs_file langchain.document_loaders.obsidian langchain.document_loaders.odt langchain.document_loaders.onedrive langchain.document_loaders.onedrive_...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-8
langchain.document_loaders.sharepoint langchain.document_loaders.sitemap langchain.document_loaders.slack_directory langchain.document_loaders.snowflake_loader langchain.document_loaders.spreedly langchain.document_loaders.srt langchain.document_loaders.stripe langchain.document_loaders.telegram langchain.document_load...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-9
langchain.embeddings.cache langchain.embeddings.clarifai langchain.embeddings.cohere langchain.embeddings.dashscope langchain.embeddings.deepinfra langchain.embeddings.edenai langchain.embeddings.elasticsearch langchain.embeddings.embaas langchain.embeddings.ernie langchain.embeddings.fake langchain.embeddings.fastembe...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-10
langchain.evaluation.qa.eval_chain langchain.evaluation.qa.generate_chain langchain.evaluation.regex_match.base langchain.evaluation.schema langchain.evaluation.scoring.eval_chain langchain.evaluation.string_distance.base langchain.graphs.arangodb_graph langchain.graphs.falkordb_graph langchain.graphs.graph_document la...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-11
langchain.llms.forefrontai langchain.llms.gigachat langchain.llms.google_palm langchain.llms.gooseai langchain.llms.gpt4all langchain.llms.gradient_ai langchain.llms.huggingface_endpoint langchain.llms.huggingface_hub langchain.llms.huggingface_pipeline langchain.llms.huggingface_text_gen_inference langchain.llms.human...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-12
langchain.llms.vllm langchain.llms.writer langchain.llms.xinference langchain.llms.yandex langchain.load.dump langchain.load.load langchain.load.serializable langchain.memory.buffer langchain.memory.buffer_window langchain.memory.chat_memory langchain.memory.chat_message_histories.cassandra langchain.memory.chat_messag...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-13
langchain.output_parsers.loading langchain.output_parsers.openai_functions langchain.output_parsers.openai_tools langchain.output_parsers.pydantic langchain.output_parsers.rail_parser langchain.output_parsers.regex langchain.output_parsers.regex_dict langchain.output_parsers.retry langchain.output_parsers.structured la...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-14
langchain.retrievers.knn langchain.retrievers.llama_index langchain.retrievers.merger_retriever langchain.retrievers.metal langchain.retrievers.milvus langchain.retrievers.multi_query langchain.retrievers.multi_vector langchain.retrievers.parent_document_retriever langchain.retrievers.pinecone_hybrid_search langchain.r...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-15
langchain.runnables.openai_functions langchain.schema.agent langchain.schema.cache langchain.schema.callbacks.base langchain.schema.callbacks.manager langchain.schema.callbacks.stdout langchain.schema.callbacks.tracers.base langchain.schema.callbacks.tracers.evaluation langchain.schema.callbacks.tracers.langchain langc...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-16
langchain.tools.ainetwork.owner langchain.tools.ainetwork.rule langchain.tools.ainetwork.transfer langchain.tools.ainetwork.utils langchain.tools.ainetwork.value langchain.tools.amadeus.base langchain.tools.amadeus.closest_airport langchain.tools.amadeus.flight_search langchain.tools.amadeus.utils langchain.tools.arxiv...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-17
langchain.tools.file_management.write langchain.tools.github.tool langchain.tools.gitlab.tool langchain.tools.gmail.base langchain.tools.gmail.create_draft langchain.tools.gmail.get_message langchain.tools.gmail.get_thread langchain.tools.gmail.search langchain.tools.gmail.send_message langchain.tools.gmail.utils langc...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-18
langchain.tools.scenexplain.tool langchain.tools.searchapi.tool langchain.tools.searx_search.tool langchain.tools.shell.tool langchain.tools.sleep.tool langchain.tools.spark_sql.tool langchain.tools.sql_database.tool langchain.tools.steamship_image_generation.tool langchain.tools.steamship_image_generation.utils langch...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-19
langchain.utilities.tensorflow_datasets langchain.utilities.twilio langchain.utilities.vertexai langchain.utilities.wikipedia langchain.utilities.wolfram_alpha langchain.utilities.zapier langchain.utils.aiter langchain.utils.env langchain.utils.formatting langchain.utils.html langchain.utils.input langchain.utils.iter ...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-20
langchain.vectorstores.momento_vector_index langchain.vectorstores.mongodb_atlas langchain.vectorstores.myscale langchain.vectorstores.neo4j_vector langchain.vectorstores.nucliadb langchain.vectorstores.opensearch_vector_search langchain.vectorstores.pgembedding langchain.vectorstores.pgvecto_rs langchain.vectorstores....
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-21
langchain_experimental.autonomous_agents.autogpt.output_parser langchain_experimental.autonomous_agents.autogpt.prompt langchain_experimental.autonomous_agents.autogpt.prompt_generator langchain_experimental.autonomous_agents.baby_agi.baby_agi langchain_experimental.autonomous_agents.baby_agi.task_creation langchain_ex...
lang/api.python.langchain.com/en/latest/_modules/index.html
95552857791c-22
langchain_experimental.llm_bash.prompt langchain_experimental.llm_symbolic_math.base langchain_experimental.llms.anthropic_functions langchain_experimental.llms.jsonformer_decoder langchain_experimental.llms.llamaapi langchain_experimental.llms.lmformatenforcer_decoder langchain_experimental.llms.rellm_decoder langchai...
lang/api.python.langchain.com/en/latest/_modules/index.html
a5972cc239fa-0
Source code for sqlalchemy.orm.decl_base # ext/declarative/base.py # Copyright (C) 2005-2023 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php """Internal implementation for decl...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-1
from .. import event from .. import exc from .. import util from ..sql import expression from ..sql.base import _NoArg from ..sql.schema import Column from ..sql.schema import Table from ..util import topological from ..util.typing import _AnnotationScanType from ..util.typing import is_fwd_ref from ..util.typing impor...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-2
__table_args__: Optional[_TableArgsType] _sa_apply_dc_transforms: Optional[_DataclassArguments] def __declare_first__(self) -> None: ... def __declare_last__(self) -> None: ... class _DataclassArguments(TypedDict): init: Union[_NoArg, bool] repr: Union[_NoArg, bool] eq: Union[_No...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-3
return not _get_immediate_cls_attr( cls, "_sa_decl_prepare_nocascade", strict=True ) # regular mapping elif _is_mapped_class(cls): return True else: return False def _resolve_for_abstract_or_classical(cls: Type[Any]) -> Optional[Type[Any]]: if cls is object: r...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-4
if attrname in cls.__dict__: return getattr(cls, attrname) for base in cls.__mro__[1:]: _is_classical_inherits = _dive_for_cls_manager(base) is not None if attrname in base.__dict__ and ( base is cls or ( (base in cls.__bases__ if strict else True) ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-5
return cast("MappedClassProtocol[_O]", cls).__mapper__ @util.preload_module("sqlalchemy.orm.decl_api") def _is_declarative_props(obj: Any) -> bool: _declared_attr_common = util.preloaded.orm_decl_api._declared_attr_common return isinstance(obj, (_declared_attr_common, util.classproperty)) def _check_declared_pr...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-6
) -> Optional[_MapperConfig]: manager = attributes.opt_manager_of_class(cls) if manager and manager.class_ is cls_: raise exc.InvalidRequestError( f"Class {cls!r} already has been instrumented declaratively" ) if cls_.__dict__.get("__abstract__", False): ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-7
"Mapper." % self.cls ) def set_cls_attribute(self, attrname: str, value: _T) -> _T: manager = instrumentation.manager_of_class(self.cls) manager.install_member(attrname, value) return value def map(self, mapper_kw: _MapperKwArgs = ...) -> Mapper[Any]: raise NotImp...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-8
inherits = mapper_kw.get("inherits", None) if inherits is None: # since we search for classical mappings now, search for # multiple mapped bases as well and raise an error. inherits_search = [] for base_ in cls.__bases__: c = _resolve_for_abstract_...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-9
"allow_dataclass_fields", "dataclass_setup_arguments", "is_dataclass_prior_to_mapping", "allow_unmapped_annotations", ) is_deferred = False registry: _RegistryType clsdict_view: _ClassDict collected_annotations: Dict[str, _CollectedAnnotation] collected_attributes: Dict[s...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-10
cls_: Type[_O], dict_: _ClassDict, table: Optional[FromClause], mapper_kw: _MapperKwArgs, ): # grab class dict before the instrumentation manager has been added. # reduces cycles self.clsdict_view = ( util.immutabledict(dict_) if dict_ else util.EMPTY_DICT...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-11
"SQLAlchemy mapped dataclasses can't consume mapping " "information from dataclass.Field() objects if the immediate " "class is not already a dataclass." ) # if already a dataclass, and __sa_dataclass_metadata_key__ present, # then also look inside of dataclas...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-12
) -> Callable[[str, Any], bool]: """Produce a function that checks if a class has overridden an attribute, taking SQLAlchemy-enabled dataclass fields into account. """ if self.allow_dataclass_fields: sa_dataclass_metadata_key = _get_immediate_cls_attr( cls, "_...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-13
ret = getattr(cls, key, obj) if ret is obj: return False # for dataclasses, this could be the # 'default' of the field. so filter more specifically # for an already-mapped InstrumentedAttribute if ret is not absent and ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-14
cls, "__sa_dataclass_metadata_key__" ) else: sa_dataclass_metadata_key = None if not sa_dataclass_metadata_key: def local_attributes_for_class() -> ( Iterable[Tuple[str, Any, Any, bool]] ): return ( ( ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-15
attribute_is_overridden = self._cls_attr_override_checker(self.cls) bases = [] for base in cls.__mro__: # collect bases and make sure standalone columns are copied # to be the column they will ultimately be on the class, # so that declared_attr functions use the right...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-16
check_decl = _check_declared_props_nocascade( obj, name, cls ) if not mapper_args_fn and ( not class_mapped or check_decl ): # don't even invoke __mapper_args__ unt...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-17
util.warn( "Regular (i.e. not __special__) " "attribute '%s.%s' uses @declared_attr, " "but owning class %s is mapped - " "not applying to subclass %s." % (base.__name__, name, bas...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-18
"skipping" % (name, cls) ) collected_attributes[name] = column_copies[ obj ] = ret = obj.__get__(obj, cls) setattr(cls, name, ret) else: ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-19
self._collect_annotation( name, obj._collect_return_annotation(), base, True, obj, ) elif _is_mapped_annotation(annotation, cls, base): ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-20
name, annotation, base, None, obj ) is_mapped = ( collected_annotation is not None and collected_annotation.mapped_container is not None ) generated_obj = ( collected_a...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-21
def _allow_dataclass_field( key: str, originating_class: Type[Any] ) -> bool: if ( originating_class is not self.cls and "__dataclass_fields__" not in originating_class.__dict__ ): warn_for_non_dc_attrs[originating_class].append...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-22
) ] if warn_for_non_dc_attrs: for ( originating_class, non_dc_attrs, ) in warn_for_non_dc_attrs.items(): util.warn_deprecated( f"When transforming {self.cls} to a dataclass, " f"attribute(s) "...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-23
cls_annotations = util.get_annotations(klass) new_anno = {} for name, annotation in cls_annotations.items(): if _is_mapped_annotation(annotation, klass, klass): extracted = _extract_mapped_subtype( annotation, klass, ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-24
if v is not _NoArg.NO_ARG and k != "dataclass_callable" }, ) except (TypeError, ValueError) as ex: raise exc.InvalidRequestError( f"Python dataclasses error encountered when creating " f"dataclass for {klass.__name__!r}: " f...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-25
attr_value: Any, ) -> Optional[_CollectedAnnotation]: if name in self.collected_annotations: return self.collected_annotations[name] if raw_annotation is None: return None is_dataclass = self.is_dataclass_prior_to_mapping allow_unmapped = self.allow_unmapped_a...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-26
if isinstance(elem, _IntrospectsAnnotations): attr_value = elem.found_in_pep593_annotated() self.collected_annotations[name] = ca = _CollectedAnnotation( raw_annotation, mapped_container, extracted_mapped_annotation, is_dataclass, a...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-27
and obj is None and _is_mapped_annotation(annotation, cls, originating_class) ): # obj is None means this is the annotation only path if attribute_is_overridden(name, obj): # perform same "overridden" check as we do for ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-28
if ( fk._table_column is not None and fk._table_column.table is None ): raise exc.InvalidRequestError( "Columns with foreign keys to " ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-29
"Use of @declared_attr.cascading only applies to " "Declarative 'mixin' and 'abstract' classes. " "Currently, this flag is ignored on mapped class " "%s" % self.cls ) value = getattr(cls, k) elif ( ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-30
if not late_mapped: setattr(cls, k, value) continue # we expect to see the name 'metadata' in some valid cases; # however at this point we see it's assigned to something trying # to be mapped, so raise for that. # TODO: should "registry...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-31
# assignment or allow_unmapped_annotations ): try: value.declarative_scan( self, self.registry, cls, ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-32
f"class does not specify " "SQLAlchemy native dataclass configuration." ) if not isinstance(value, (MapperProperty, _MapsColumns)): # filter for _DCAttributeOptions objects that aren't # MapperPropert...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-33
if not isinstance(c, CompositeProperty): name_to_prop_key[col.name].add(key) declared_columns.add(col) # we would assert this, however we want the below # warning to take effect instead. See #9630 # assert col not i...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-34
% (self.classname, name, (", ".join(sorted(keys)))) ) def _setup_table(self, table: Optional[FromClause] = None) -> None: cls = self.cls cls_as_Decl = cast("MappedClassProtocol[Any]", cls) tablename = self.tablename table_args = self.table_args clsdict_view = ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-35
) table = self.set_cls_attribute( "__table__", table_cls( tablename, self._metadata_for_cls(manager), *sorted_columns, *args, **table_kw, ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-36
% (cls, inherits_search) ) inherits = inherits_search[0] elif isinstance(inherits, Mapper): inherits = inherits.class_ self.inherits = inherits clsdict_view = self.clsdict_view if "__table__" not in clsdict_view and self.tablename is None: ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-37
f"Can't declare columns on single-table-inherited " f"subclass {self.cls}; superclass {self.inherits} " "is not mapped to a Table" ) for col in declared_columns: assert inherited_table is not None ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-38
# than the original columns from any mixins for k in ("version_id_col", "polymorphic_on"): if k in mapper_args: v = mapper_args[k] mapper_args[k] = self.column_copies.get(v, v) if "primary_key" in mapper_args: mapper_args["primary_key"] = [ ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-39
}.union(inherited_mapper.exclude_properties or ()) exclude_properties.difference_update( [c.key for c in self.declared_columns] ) # look through columns in the current mapper that # are keyed to a propname different than the colname ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-40
def _as_dc_declaredattr( field_metadata: Mapping[str, Any], sa_dataclass_metadata_key: str ) -> Any: # wrap lambdas inside dataclass fields inside an ad-hoc declared_attr. # we can't write it because field.metadata is immutable :( so we have # to go through extra trouble to compare these decl_api = ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-41
# 2.6 fails on weakref if class_ is an old style class return isinstance(class_, type) and weakref.ref(class_) in cls._configs @classmethod def raise_unmapped_for_cls(cls, class_: Type[Any]) -> NoReturn: if hasattr(class_, "_sa_raise_deferred_config"): class_._sa_raise_deferred_confi...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-42
) return list(topological.sort(tuples, classes_for_base)) def map(self, mapper_kw: _MapperKwArgs = util.EMPTY_DICT) -> Mapper[Any]: self._configs.pop(self._cls, None) return super().map(mapper_kw) def _add_attribute( cls: Type[Any], key: str, value: MapperProperty[Any] ) -> None: """...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-43
if mp: mapped_cls.__mapper__.add_property(key, mp) elif isinstance(value, MapperProperty): mapped_cls.__mapper__.add_property(key, value) elif isinstance(value, QueryableAttribute) and value.key != key: # detect a QueryableAttribute that's already mapped being ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
a5972cc239fa-44
values in ``kwargs``. Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships. """ cls_ = type(self) for k in kwargs: if not hasattr(cls_, k): raise TypeError( "%r is an inv...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/decl_base.html
e415edc200d2-0
Source code for sqlalchemy.orm.instrumentation # orm/instrumentation.py # Copyright (C) 2005-2023 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php # mypy: allow-untyped-defs, al...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-1
from . import interfaces from . import state from ._typing import _O from .attributes import _is_collection_attribute_impl from .. import util from ..event import EventTarget from ..util import HasMemoized from ..util.typing import Literal from ..util.typing import Protocol if TYPE_CHECKING: from ._typing import _R...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-2
init_method: Optional[Callable[..., None]] original_init: Optional[Callable[..., None]] = None factory: Optional[_ManagerFactory] declarative_scan: Optional[weakref.ref[_MapperConfig]] = None registry: _RegistryType if not TYPE_CHECKING: # starts as None during setup registry = None ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-3
self.update(base_) cast( "InstanceEvents", self.dispatch._events )._new_classmanager_instance(class_, self) for basecls in class_.__mro__: mgr = opt_manager_of_class(basecls) if mgr is not None: self.dispatch._update(mgr.dispatch) self....
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-4
self.init_method if self.init_method is not None and self.class_.__init__ is object.__init__ else self.class_.__init__ ) if finalize and not self._finalized: self._finalize() def _finalize(self) -> None: if self._finalized: ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-5
def _all_sqla_attributes(self, exclude=None): """return an iterator of all classbound attributes that are implement :class:`.InspectionAttr`. This includes :class:`.QueryableAttribute` as well as extension types such as :class:`.hybrid_property` and :class:`.AssociationProxy`. ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-6
i.e. has an impl. """ return key in self and self[key].impl is not None def _subclass_manager(self, cls: Type[_T]) -> ClassManager[_T]: """Create a new ClassManager for a subclass of this ClassManager's class. This is called automatically when attributes are instrumented so t...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-7
def instrument_attribute( self, key: str, inst: QueryableAttribute[Any], propagated: bool = False, ) -> None: if propagated: if key in self.local_attrs: return # don't override local attr with inherited attr else: self.local_at...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-8
for key in list(self.originals): self.uninstall_member(key) self.mapper = None self.dispatch = None # type: ignore self.new_init = None self.info.clear() for key in list(self): if key in self.local_attrs: self.uninstrument_attribute(key) ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-9
) -> _CollectionFactoryType: return collections.prepare_instrumentation(collection_class) def initialize_collection( self, key: str, state: InstanceState[_O], factory: _CollectionFactoryType, ) -> Tuple[collections.CollectionAdapter, _AdaptedCollectionProtocol]: u...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-10
if state is None: state = self._state_constructor(instance, self) self._state_setter(instance, state) def teardown_instance(self, instance: _O) -> None: delattr(instance, self.STATE_ATTR) def _serialize( self, state: InstanceState[_O], state_dict: Dict[str, Any] ) -> _Ser...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-11
def __bool__(self) -> bool: """All ClassManagers are non-zero regardless of attribute state.""" return True def __repr__(self) -> str: return "<%s of %r at %x>" % ( self.__class__.__name__, self.class_, id(self), ) class _SerializeManager: """P...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-12
"""Factory for new ClassManager instances.""" dispatch: dispatcher[InstrumentationFactory] def create_manager_for_cls(self, class_: Type[_O]) -> ClassManager[_O]: assert class_ is not None assert opt_manager_of_class(class_) is None # give a more complicated subclass # a chance t...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-13
manager_of_class = _default_manager_getter = base.manager_of_class opt_manager_of_class = _default_opt_manager_getter = base.opt_manager_of_class def register_class( class_: Type[_O], finalize: bool = True, mapper: Optional[Mapper[_O]] = None, registry: Optional[_RegistryType] = None, declarative_sc...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
e415edc200d2-14
# TODO: we should use the ClassManager's notion of the # original '__init__' method, once ClassManager is fixed # to always reference that. if original_init is None: original_init = class_.__init__ # Go through some effort here and don't change the user's __init__ # calling signature, includ...
lang/api.python.langchain.com/en/latest/_modules/sqlalchemy/orm/instrumentation.html
bcf74a8f2b9d-0
Source code for html.parser """A parser for HTML and XHTML.""" # This file is based on sgmllib.py, but the API is slightly different. # XXX There should be a way to distinguish between PCDATA (parsed # character data -- the normal case), RCDATA (replaceable character # data -- only char and entity references and end ta...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-1
attrfind_tolerant = re.compile( r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*' r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*') locatestarttagend_tolerant = re.compile(r""" <[a-zA-Z][^\t\n\r\f />\x00]* # tag name (?:[\s/]* # optional whitespace before attribute name ...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-2
p.close() Start tags are handled by calling self.handle_starttag() or self.handle_startendtag(); end tags by self.handle_endtag(). The data between tags is passed from the parser to the derived class by calling self.handle_data() with the data as argument (the data may be split up in arbitrary chun...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-3
self.goahead(1) __starttag_text = None def get_starttag_text(self): """Return full source of start tag: '<...>'.""" return self.__starttag_text def set_cdata_mode(self, elem): self.cdata_elem = elem.lower() self.interesting = re.compile(r'</\s*%s\s*>' % self.cdata_elem, re.I)...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-4
not re.compile(r'[\s;]').search(rawdata, amppos)): break # wait till we get all the text j = n else: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: ...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-5
k = i + 1 else: k += 1 if self.convert_charrefs and not self.cdata_elem: self.handle_data(unescape(rawdata[i:k])) else: self.handle_data(rawdata[i:k]) i = self.updatepos(i,...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-6
# not the end of the buffer, and can't be confused # with some other construct self.handle_data("&") i = self.updatepos(i, i + 1) else: break else: assert 0, "interesting.search() lied" # ...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-7
else: return self.parse_bogus_comment(i) # Internal -- parse bogus comment, return length or -1 if not terminated # see http://www.w3.org/TR/html5/tokenization.html#bogus-comment-state def parse_bogus_comment(self, i, report=1): rawdata = self.rawdata assert rawdata[i:i+2] in ('<...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-8
match = tagfind_tolerant.match(rawdata, i+1) assert match, 'unexpected call to parse_starttag()' k = match.end() self.lasttag = tag = match.group(1).lower() while k < endpos: m = attrfind_tolerant.match(rawdata, k) if not m: break attrn...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-9
j = m.end() next = rawdata[j:j+1] if next == ">": return j + 1 if next == "/": if rawdata.startswith("/>", j): return j + 2 if rawdata.startswith("/", j): # buffer boundary ret...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-10
if not namematch: # w3.org/TR/html5/tokenization.html#end-tag-open-state if rawdata[i:i+3] == '</>': return i+3 else: return self.parse_bogus_comment(i) tagname = namematch.group(1).lower() # consume and igno...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
bcf74a8f2b9d-11
pass # Overridable -- handle data def handle_data(self, data): pass # Overridable -- handle comment def handle_comment(self, data): pass # Overridable -- handle declaration def handle_decl(self, decl): pass # Overridable -- handle processing instruction def handle...
lang/api.python.langchain.com/en/latest/_modules/html/parser.html
229dac6b9424-0
Source code for langchain_experimental.utilities.python import functools import logging import multiprocessing import sys from io import StringIO from typing import Dict, Optional from langchain.pydantic_v1 import BaseModel, Field logger = logging.getLogger(__name__) @functools.lru_cache(maxsize=None) def warn_once() -...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/utilities/python.html
229dac6b9424-1
# create a Process p = multiprocessing.Process( target=self.worker, args=(command, self.globals, self.locals, queue) ) # start it p.start() # wait for the process to finish or kill it after timeout seconds p.join(timeout) ...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/utilities/python.html
3520f0278269-0
Source code for langchain_experimental.pal_chain.base """Implements Program-Aided Language Models. This module implements the Program-Aided Language Models (PAL) for generating code solutions. PAL is a technique described in the paper "Program-Aided Language Models" (https://arxiv.org/pdf/2211.10435.pdf). """ from __fu...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/pal_chain/base.html
3520f0278269-1
Must be one of PALValidation.SOLUTION_EXPRESSION_TYPE_FUNCTION, PALValidation.SOLUTION_EXPRESSION_TYPE_VARIABLE. allow_imports (bool): Allow import statements. allow_command_exec (bool): Allow using known command execution functions. """ self.solution_expression_n...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/pal_chain/base.html
3520f0278269-2
This class implements the Program-Aided Language Models (PAL) for generating code solutions. PAL is a technique described in the paper "Program-Aided Language Models" (https://arxiv.org/pdf/2211.10435.pdf). *Security note*: This class implements an AI technique that generates and evaluates Python co...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/pal_chain/base.html
3520f0278269-3
class Config: """Configuration for this pydantic object.""" extra = Extra.forbid arbitrary_types_allowed = True @property def input_keys(self) -> List[str]: """Return the singular input key. :meta private: """ return self.llm_chain.prompt.input_variables ...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/pal_chain/base.html
3520f0278269-4
return output [docs] @classmethod def validate_code(cls, code: str, code_validations: PALValidation) -> None: try: code_tree = ast.parse(code) except (SyntaxError, UnicodeDecodeError): raise ValueError(f"Generated code is not valid python code: {code}") except Type...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/pal_chain/base.html
3520f0278269-5
== code_validations.solution_expression_name ): found_solution_expr = True if isinstance(node, ast.Import) or isinstance(node, ast.ImportFrom): has_imports = True if not found_solution_expr: raise ValueError( ...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/pal_chain/base.html
3520f0278269-6
"""Load PAL from math prompt. Args: llm (BaseLanguageModel): The language model to use for generating code. Returns: PALChain: An instance of PALChain. """ llm_chain = LLMChain(llm=llm, prompt=MATH_PROMPT) code_validations = PALValidation( solu...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/pal_chain/base.html
d409db8b99c8-0
Source code for langchain_experimental.tools.python.tool """A tool for running python code in a REPL.""" import ast import asyncio import re import sys from contextlib import redirect_stdout from io import StringIO from typing import Any, Dict, Optional, Type from langchain.callbacks.manager import ( AsyncCallbackM...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/tools/python/tool.html
d409db8b99c8-1
"with `print(...)`." ) python_repl: PythonREPL = Field(default_factory=_get_default_python_repl) sanitize_input: bool = True def _run( self, query: str, run_manager: Optional[CallbackManagerForToolRun] = None, ) -> Any: """Use the tool.""" if self.sanitize_inp...
lang/api.python.langchain.com/en/latest/_modules/langchain_experimental/tools/python/tool.html