Chat Engines

Chat engine is a high-level interface for having a conversation with
your data (multiple back-and-forth instead of a single question &
answer).
Chat Engine Implementations
Below we show specific chat engine implementations.
Chat Engines
^^^^^^^^^^^^
* Simple Chat Engine
* Condense Question Chat Engine
Chat Engine Types
class llama_index.chat_engine.types.AgentChatResponse(response: str = '', sources: ~typing.List[~llama_index.tools.types.ToolOutput] = <factory>, source_nodes: ~typing.List[~llama_index.schema.NodeWithScore] = <factory>)
   Agent chat response.
class llama_index.chat_engine.types.BaseChatEngine
   Base Chat Engine.
   abstract async achat(message: str, chat_history: Optional[List[ChatMessage]] = None) -> Union[AgentChatResponse, StreamingAgentChatResponse]
      Async version of main chat interface.
   abstract async astream_chat(message: str, chat_history: Optional[List[ChatMessage]] = None) -> StreamingAgentChatResponse
      Async version of main chat interface.
   abstract chat(message: str, chat_history: Optional[List[ChatMessage]] = None) -> Union[AgentChatResponse, StreamingAgentChatResponse]
      Main chat interface.
   chat_repl() -> None
      Enter interactive chat REPL.
   abstract reset() -> None
      Reset conversation state.
   abstract stream_chat(message: str, chat_history: Optional[List[ChatMessage]] = None) -> StreamingAgentChatResponse
      Stream chat interface.
class llama_index.chat_engine.types.ChatMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
   Chat Engine Modes.
   BEST = 'best'
      Select the best chat engine based on the current LLM.
      Corresponds to *OpenAIAgent* if using an OpenAI model that
      supports function calling API, otherwise, corresponds to
      *ReActAgent*.
   CONDENSE_QUESTION = 'condense_question'
      Corresponds to *CondenseQuestionChatEngine*.
      First generate a standalone question from conversation context
      and last message, then query the query engine for a response.
   CONTEXT = 'context'
      Corresponds to *ContextChatEngine*.
      First retrieve text from the index using the user's message,
      then use the context in the system prompt to generate a
      response.
   OPENAI = 'openai'
      Corresponds to *OpenAIAgent*.
      Use an OpenAI function calling agent loop.
      NOTE: only works with OpenAI models that support function
      calling API.
   REACT = 'react'
      Corresponds to *ReActAgent*.
      Use a ReAct agent loop with query engine tools.
   SIMPLE = 'simple'
      Corresponds to *SimpleChatEngine*.
      Chat with LLM, without making use of a knowledge base.
   capitalize()
      Return a capitalized version of the string.
      More specifically, make the first character have upper case and
      the rest lower case.
   casefold()
      Return a version of the string suitable for caseless
      comparisons.
   center(width, fillchar=' ', /)
      Return a centered string of length width.
      Padding is done using the specified fill character (default is a
      space).
   count(sub[, start[, end]]) -> int
      Return the number of non-overlapping occurrences of substring
      sub in string S[start:end].  Optional arguments start and end
      are interpreted as in slice notation.
   encode(encoding='utf-8', errors='strict')
      Encode the string using the codec registered for encoding.
      encoding
         The encoding in which to encode the string.
      errors
         The error handling scheme to use for encoding errors. The
         default is 'strict' meaning that encoding errors raise a
         UnicodeEncodeError.  Other possible values are 'ignore',

Chat Engines

         'replace' and 'xmlcharrefreplace' as well as any other name
         registered with codecs.register_error that can handle
         UnicodeEncodeErrors.
   endswith(suffix[, start[, end]]) -> bool
      Return True if S ends with the specified suffix, False
      otherwise. With optional start, test S beginning at that
      position. With optional end, stop comparing S at that position.
      suffix can also be a tuple of strings to try.
   expandtabs(tabsize=8)
      Return a copy where all tab characters are expanded using
      spaces.
      If tabsize is not given, a tab size of 8 characters is assumed.
   find(sub[, start[, end]]) -> int
      Return the lowest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Return -1 on failure.
   format(*args, **kwargs) -> str
      Return a formatted version of S, using substitutions from args
      and kwargs. The substitutions are identified by braces ('{' and
      '}').
   format_map(mapping) -> str
      Return a formatted version of S, using substitutions from
      mapping. The substitutions are identified by braces ('{' and
      '}').
   index(sub[, start[, end]]) -> int
      Return the lowest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Raises ValueError when the substring is not found.
   isalnum()
      Return True if the string is an alpha-numeric string, False
      otherwise.
      A string is alpha-numeric if all characters in the string are
      alpha-numeric and there is at least one character in the string.
   isalpha()
      Return True if the string is an alphabetic string, False
      otherwise.
      A string is alphabetic if all characters in the string are
      alphabetic and there is at least one character in the string.
   isascii()
      Return True if all characters in the string are ASCII, False
      otherwise.
      ASCII characters have code points in the range U+0000-U+007F.
      Empty string is ASCII too.
   isdecimal()
      Return True if the string is a decimal string, False otherwise.
      A string is a decimal string if all characters in the string are
      decimal and there is at least one character in the string.
   isdigit()
      Return True if the string is a digit string, False otherwise.
      A string is a digit string if all characters in the string are
      digits and there is at least one character in the string.
   isidentifier()
      Return True if the string is a valid Python identifier, False
      otherwise.
      Call keyword.iskeyword(s) to test whether string s is a reserved
      identifier, such as "def" or "class".
   islower()
      Return True if the string is a lowercase string, False
      otherwise.
      A string is lowercase if all cased characters in the string are
      lowercase and there is at least one cased character in the
      string.
   isnumeric()
      Return True if the string is a numeric string, False otherwise.
      A string is numeric if all characters in the string are numeric
      and there is at least one character in the string.
   isprintable()
      Return True if the string is printable, False otherwise.
      A string is printable if all of its characters are considered
      printable in repr() or if it is empty.
   isspace()
      Return True if the string is a whitespace string, False
      otherwise.
      A string is whitespace if all characters in the string are
      whitespace and there is at least one character in the string.

Chat Engines

   istitle()
      Return True if the string is a title-cased string, False
      otherwise.
      In a title-cased string, upper- and title-case characters may
      only follow uncased characters and lowercase characters only
      cased ones.
   isupper()
      Return True if the string is an uppercase string, False
      otherwise.
      A string is uppercase if all cased characters in the string are
      uppercase and there is at least one cased character in the
      string.
   join(iterable, /)
      Concatenate any number of strings.
      The string whose method is called is inserted in between each
      given string. The result is returned as a new string.
      Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
   ljust(width, fillchar=' ', /)
      Return a left-justified string of length width.
      Padding is done using the specified fill character (default is a
      space).
   lower()
      Return a copy of the string converted to lowercase.
   lstrip(chars=None, /)
      Return a copy of the string with leading whitespace removed.
      If chars is given and not None, remove characters in chars
      instead.
   static maketrans()
      Return a translation table usable for str.translate().
      If there is only one argument, it must be a dictionary mapping
      Unicode ordinals (integers) or characters to Unicode ordinals,
      strings or None. Character keys will be then converted to
      ordinals. If there are two arguments, they must be strings of
      equal length, and in the resulting dictionary, each character in
      x will be mapped to the character at the same position in y. If
      there is a third argument, it must be a string, whose characters
      will be mapped to None in the result.
   partition(sep, /)
      Partition the string into three parts using the given separator.
      This will search for the separator in the string.  If the
      separator is found, returns a 3-tuple containing the part before
      the separator, the separator itself, and the part after it.
      If the separator is not found, returns a 3-tuple containing the
      original string and two empty strings.
   removeprefix(prefix, /)
      Return a str with the given prefix string removed if present.
      If the string starts with the prefix string, return
      string[len(prefix):]. Otherwise, return a copy of the original
      string.
   removesuffix(suffix, /)
      Return a str with the given suffix string removed if present.
      If the string ends with the suffix string and that suffix is not
      empty, return string[:-len(suffix)]. Otherwise, return a copy of
      the original string.
   replace(old, new, count=-1, /)
      Return a copy with all occurrences of substring old replaced by
      new.
         count
            Maximum number of occurrences to replace. -1 (the default
            value) means replace all occurrences.
      If the optional argument count is given, only the first count
      occurrences are replaced.
   rfind(sub[, start[, end]]) -> int
      Return the highest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Return -1 on failure.
   rindex(sub[, start[, end]]) -> int
      Return the highest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Raises ValueError when the substring is not found.
   rjust(width, fillchar=' ', /)
      Return a right-justified string of length width.

Chat Engines

      Padding is done using the specified fill character (default is a
      space).
   rpartition(sep, /)
      Partition the string into three parts using the given separator.
      This will search for the separator in the string, starting at
      the end. If the separator is found, returns a 3-tuple containing
      the part before the separator, the separator itself, and the
      part after it.
      If the separator is not found, returns a 3-tuple containing two
      empty strings and the original string.
   rsplit(sep=None, maxsplit=-1)
      Return a list of the substrings in the string, using sep as the
      separator string.
         sep
            The separator used to split the string.
            When set to None (the default value), will split on any
            whitespace character (including n r t f and spaces) and
            will discard empty strings from the result.
         maxsplit
            Maximum number of splits (starting from the left). -1 (the
            default value) means no limit.
      Splitting starts at the end of the string and works to the
      front.
   rstrip(chars=None, /)
      Return a copy of the string with trailing whitespace removed.
      If chars is given and not None, remove characters in chars
      instead.
   split(sep=None, maxsplit=-1)
      Return a list of the substrings in the string, using sep as the
      separator string.
         sep
            The separator used to split the string.
            When set to None (the default value), will split on any
            whitespace character (including n r t f and spaces) and
            will discard empty strings from the result.
         maxsplit
            Maximum number of splits (starting from the left). -1 (the
            default value) means no limit.
      Note, str.split() is mainly useful for data that has been
      intentionally delimited.  With natural text that includes
      punctuation, consider using the regular expression module.
   splitlines(keepends=False)
      Return a list of the lines in the string, breaking at line
      boundaries.
      Line breaks are not included in the resulting list unless
      keepends is given and true.
   startswith(prefix[, start[, end]]) -> bool
      Return True if S starts with the specified prefix, False
      otherwise. With optional start, test S beginning at that
      position. With optional end, stop comparing S at that position.
      prefix can also be a tuple of strings to try.
   strip(chars=None, /)
      Return a copy of the string with leading and trailing whitespace
      removed.
      If chars is given and not None, remove characters in chars
      instead.
   swapcase()
      Convert uppercase characters to lowercase and lowercase
      characters to uppercase.
   title()
      Return a version of the string where each word is titlecased.
      More specifically, words start with uppercased characters and
      all remaining cased characters have lower case.
   translate(table, /)
      Replace each character in the string using the given translation
      table.
         table
            Translation table, which must be a mapping of Unicode
            ordinals to Unicode ordinals, strings, or None.
      The table must implement lookup/indexing via __getitem__, for
      instance a dictionary or list.  If this operation raises
      LookupError, the character is left untouched.  Characters mapped
      to None are deleted.
   upper()
      Return a copy of the string converted to uppercase.
   zfill(width, /)
      Pad a numeric string with zeros on the left, to fill a field of
      the given width.
      The string is never truncated.
class llama_index.chat_engine.types.ChatResponseMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Chat Engines

   Flag toggling waiting/streaming in *Agent._chat*.
   capitalize()
      Return a capitalized version of the string.
      More specifically, make the first character have upper case and
      the rest lower case.
   casefold()
      Return a version of the string suitable for caseless
      comparisons.
   center(width, fillchar=' ', /)
      Return a centered string of length width.
      Padding is done using the specified fill character (default is a
      space).
   count(sub[, start[, end]]) -> int
      Return the number of non-overlapping occurrences of substring
      sub in string S[start:end].  Optional arguments start and end
      are interpreted as in slice notation.
   encode(encoding='utf-8', errors='strict')
      Encode the string using the codec registered for encoding.
      encoding
         The encoding in which to encode the string.
      errors
         The error handling scheme to use for encoding errors. The
         default is 'strict' meaning that encoding errors raise a
         UnicodeEncodeError.  Other possible values are 'ignore',
         'replace' and 'xmlcharrefreplace' as well as any other name
         registered with codecs.register_error that can handle
         UnicodeEncodeErrors.
   endswith(suffix[, start[, end]]) -> bool
      Return True if S ends with the specified suffix, False
      otherwise. With optional start, test S beginning at that
      position. With optional end, stop comparing S at that position.
      suffix can also be a tuple of strings to try.
   expandtabs(tabsize=8)
      Return a copy where all tab characters are expanded using
      spaces.
      If tabsize is not given, a tab size of 8 characters is assumed.
   find(sub[, start[, end]]) -> int
      Return the lowest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Return -1 on failure.
   format(*args, **kwargs) -> str
      Return a formatted version of S, using substitutions from args
      and kwargs. The substitutions are identified by braces ('{' and
      '}').
   format_map(mapping) -> str
      Return a formatted version of S, using substitutions from
      mapping. The substitutions are identified by braces ('{' and
      '}').
   index(sub[, start[, end]]) -> int
      Return the lowest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Raises ValueError when the substring is not found.
   isalnum()
      Return True if the string is an alpha-numeric string, False
      otherwise.
      A string is alpha-numeric if all characters in the string are
      alpha-numeric and there is at least one character in the string.
   isalpha()
      Return True if the string is an alphabetic string, False
      otherwise.
      A string is alphabetic if all characters in the string are
      alphabetic and there is at least one character in the string.
   isascii()
      Return True if all characters in the string are ASCII, False
      otherwise.
      ASCII characters have code points in the range U+0000-U+007F.
      Empty string is ASCII too.
   isdecimal()
      Return True if the string is a decimal string, False otherwise.
      A string is a decimal string if all characters in the string are
      decimal and there is at least one character in the string.
   isdigit()
      Return True if the string is a digit string, False otherwise.
      A string is a digit string if all characters in the string are
      digits and there is at least one character in the string.
   isidentifier()

Chat Engines

      Return True if the string is a valid Python identifier, False
      otherwise.
      Call keyword.iskeyword(s) to test whether string s is a reserved
      identifier, such as "def" or "class".
   islower()
      Return True if the string is a lowercase string, False
      otherwise.
      A string is lowercase if all cased characters in the string are
      lowercase and there is at least one cased character in the
      string.
   isnumeric()
      Return True if the string is a numeric string, False otherwise.
      A string is numeric if all characters in the string are numeric
      and there is at least one character in the string.
   isprintable()
      Return True if the string is printable, False otherwise.
      A string is printable if all of its characters are considered
      printable in repr() or if it is empty.
   isspace()
      Return True if the string is a whitespace string, False
      otherwise.
      A string is whitespace if all characters in the string are
      whitespace and there is at least one character in the string.
   istitle()
      Return True if the string is a title-cased string, False
      otherwise.
      In a title-cased string, upper- and title-case characters may
      only follow uncased characters and lowercase characters only
      cased ones.
   isupper()
      Return True if the string is an uppercase string, False
      otherwise.
      A string is uppercase if all cased characters in the string are
      uppercase and there is at least one cased character in the
      string.
   join(iterable, /)
      Concatenate any number of strings.
      The string whose method is called is inserted in between each
      given string. The result is returned as a new string.
      Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
   ljust(width, fillchar=' ', /)
      Return a left-justified string of length width.
      Padding is done using the specified fill character (default is a
      space).
   lower()
      Return a copy of the string converted to lowercase.
   lstrip(chars=None, /)
      Return a copy of the string with leading whitespace removed.
      If chars is given and not None, remove characters in chars
      instead.
   static maketrans()
      Return a translation table usable for str.translate().
      If there is only one argument, it must be a dictionary mapping
      Unicode ordinals (integers) or characters to Unicode ordinals,
      strings or None. Character keys will be then converted to
      ordinals. If there are two arguments, they must be strings of
      equal length, and in the resulting dictionary, each character in
      x will be mapped to the character at the same position in y. If
      there is a third argument, it must be a string, whose characters
      will be mapped to None in the result.
   partition(sep, /)
      Partition the string into three parts using the given separator.
      This will search for the separator in the string.  If the
      separator is found, returns a 3-tuple containing the part before
      the separator, the separator itself, and the part after it.
      If the separator is not found, returns a 3-tuple containing the
      original string and two empty strings.
   removeprefix(prefix, /)
      Return a str with the given prefix string removed if present.
      If the string starts with the prefix string, return
      string[len(prefix):]. Otherwise, return a copy of the original
      string.
   removesuffix(suffix, /)
      Return a str with the given suffix string removed if present.
      If the string ends with the suffix string and that suffix is not
      empty, return string[:-len(suffix)]. Otherwise, return a copy of

Chat Engines

      the original string.
   replace(old, new, count=-1, /)
      Return a copy with all occurrences of substring old replaced by
      new.
         count
            Maximum number of occurrences to replace. -1 (the default
            value) means replace all occurrences.
      If the optional argument count is given, only the first count
      occurrences are replaced.
   rfind(sub[, start[, end]]) -> int
      Return the highest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Return -1 on failure.
   rindex(sub[, start[, end]]) -> int
      Return the highest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Raises ValueError when the substring is not found.
   rjust(width, fillchar=' ', /)
      Return a right-justified string of length width.
      Padding is done using the specified fill character (default is a
      space).
   rpartition(sep, /)
      Partition the string into three parts using the given separator.
      This will search for the separator in the string, starting at
      the end. If the separator is found, returns a 3-tuple containing
      the part before the separator, the separator itself, and the
      part after it.
      If the separator is not found, returns a 3-tuple containing two
      empty strings and the original string.
   rsplit(sep=None, maxsplit=-1)
      Return a list of the substrings in the string, using sep as the
      separator string.
         sep
            The separator used to split the string.
            When set to None (the default value), will split on any
            whitespace character (including n r t f and spaces) and
            will discard empty strings from the result.
         maxsplit
            Maximum number of splits (starting from the left). -1 (the
            default value) means no limit.
      Splitting starts at the end of the string and works to the
      front.
   rstrip(chars=None, /)
      Return a copy of the string with trailing whitespace removed.
      If chars is given and not None, remove characters in chars
      instead.
   split(sep=None, maxsplit=-1)
      Return a list of the substrings in the string, using sep as the
      separator string.
         sep
            The separator used to split the string.
            When set to None (the default value), will split on any
            whitespace character (including n r t f and spaces) and
            will discard empty strings from the result.
         maxsplit
            Maximum number of splits (starting from the left). -1 (the
            default value) means no limit.
      Note, str.split() is mainly useful for data that has been
      intentionally delimited.  With natural text that includes
      punctuation, consider using the regular expression module.
   splitlines(keepends=False)
      Return a list of the lines in the string, breaking at line
      boundaries.
      Line breaks are not included in the resulting list unless
      keepends is given and true.
   startswith(prefix[, start[, end]]) -> bool
      Return True if S starts with the specified prefix, False
      otherwise. With optional start, test S beginning at that
      position. With optional end, stop comparing S at that position.
      prefix can also be a tuple of strings to try.
   strip(chars=None, /)
      Return a copy of the string with leading and trailing whitespace
      removed.
      If chars is given and not None, remove characters in chars
      instead.
   swapcase()
      Convert uppercase characters to lowercase and lowercase

Chat Engines

      characters to uppercase.
   title()
      Return a version of the string where each word is titlecased.
      More specifically, words start with uppercased characters and
      all remaining cased characters have lower case.
   translate(table, /)
      Replace each character in the string using the given translation
      table.
         table
            Translation table, which must be a mapping of Unicode
            ordinals to Unicode ordinals, strings, or None.
      The table must implement lookup/indexing via __getitem__, for
      instance a dictionary or list.  If this operation raises
      LookupError, the character is left untouched.  Characters mapped
      to None are deleted.
   upper()
      Return a copy of the string converted to uppercase.
   zfill(width, /)
      Pad a numeric string with zeros on the left, to fill a field of
      the given width.
      The string is never truncated.
class llama_index.chat_engine.types.StreamingAgentChatResponse(response: str = '', sources: ~typing.List[~llama_index.tools.types.ToolOutput] = <factory>, chat_stream: ~typing.Optional[~typing.Generator[~llama_index.llms.base.ChatResponse, None, None]] = None, achat_stream: ~typing.Optional[~typing.AsyncGenerator[~llama_index.llms.base.ChatResponse, None]] = None, source_nodes: ~typing.List[~llama_index.schema.NodeWithScore] = <factory>, _queue: ~queue.Queue = <factory>, _aqueue: ~asyncio.queues.Queue = <factory>, _is_function: ~typing.Optional[bool] = None, _new_item_event: ~asyncio.locks.Event = <factory>, _is_function_false_event: ~asyncio.locks.Event = <factory>, _is_function_not_none_thread_event: ~threading.Event = <factory>)
   Streaming chat response to user and writing to chat history.
llama_index.chat_engine.types.is_function(message: ChatMessage) -> bool
   Utility for ChatMessage responses from OpenAI models.


Retrievers

Index Retrievers
Below we show index-specific retriever classes.
Index Retrievers
^^^^^^^^^^^^^^^^
* Empty Index Retriever
* Knowledge Graph Retriever
* List Retriever
* Keyword Table Retrievers
* Tree Retrievers
* Vector Store Retrievers
NOTE: our structured indices (e.g. PandasIndex) don't have any
retrievers, since they are not designed to be used with the retriever
API. Please see the Query Engine page for more details.
Additional Retrievers
Here we show additional retriever classes; these classes can augment
existing retrievers with new capabilities (e.g. query transforms).
Additional Retrievers
^^^^^^^^^^^^^^^^^^^^^
* Transform Retriever
Base Retriever
Here we show the base retriever class, which contains the *retrieve*
method which is shared amongst all retrievers.
class llama_index.indices.base_retriever.BaseRetriever
   Base retriever.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.


Transform Retriever

class llama_index.retrievers.transform_retriever.TransformRetriever(retriever: BaseRetriever, query_transform: BaseQueryTransform, transform_metadata: Optional[dict] = None)
   Transform Retriever.
   Takes in an existing retriever and a query transform and runs the
   query transform before running the retriever.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.


Knowledge Graph Retriever

KG Retrievers.
class llama_index.indices.knowledge_graph.retrievers.KGRetrieverMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
   Query mode enum for Knowledge Graphs.
   Can be passed as the enum struct, or as the underlying string.
   KEYWORD
      Default query mode, using keywords to find triplets.
      Type:
         "keyword"
   EMBEDDING
      Embedding mode, using embeddings to find similar triplets.
      Type:
         "embedding"
   HYBRID
      Hyrbid mode, combining both keywords and embeddings to find
      relevant triplets.
      Type:
         "hybrid"
   capitalize()
      Return a capitalized version of the string.
      More specifically, make the first character have upper case and
      the rest lower case.
   casefold()
      Return a version of the string suitable for caseless
      comparisons.
   center(width, fillchar=' ', /)
      Return a centered string of length width.
      Padding is done using the specified fill character (default is a
      space).
   count(sub[, start[, end]]) -> int
      Return the number of non-overlapping occurrences of substring
      sub in string S[start:end].  Optional arguments start and end
      are interpreted as in slice notation.
   encode(encoding='utf-8', errors='strict')
      Encode the string using the codec registered for encoding.
      encoding
         The encoding in which to encode the string.
      errors
         The error handling scheme to use for encoding errors. The
         default is 'strict' meaning that encoding errors raise a
         UnicodeEncodeError.  Other possible values are 'ignore',
         'replace' and 'xmlcharrefreplace' as well as any other name
         registered with codecs.register_error that can handle
         UnicodeEncodeErrors.
   endswith(suffix[, start[, end]]) -> bool
      Return True if S ends with the specified suffix, False
      otherwise. With optional start, test S beginning at that
      position. With optional end, stop comparing S at that position.
      suffix can also be a tuple of strings to try.
   expandtabs(tabsize=8)
      Return a copy where all tab characters are expanded using
      spaces.
      If tabsize is not given, a tab size of 8 characters is assumed.
   find(sub[, start[, end]]) -> int
      Return the lowest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Return -1 on failure.
   format(*args, **kwargs) -> str
      Return a formatted version of S, using substitutions from args
      and kwargs. The substitutions are identified by braces ('{' and
      '}').
   format_map(mapping) -> str
      Return a formatted version of S, using substitutions from
      mapping. The substitutions are identified by braces ('{' and
      '}').
   index(sub[, start[, end]]) -> int
      Return the lowest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Raises ValueError when the substring is not found.
   isalnum()
      Return True if the string is an alpha-numeric string, False
      otherwise.
      A string is alpha-numeric if all characters in the string are
      alpha-numeric and there is at least one character in the string.
   isalpha()
      Return True if the string is an alphabetic string, False
      otherwise.
      A string is alphabetic if all characters in the string are
      alphabetic and there is at least one character in the string.
   isascii()
      Return True if all characters in the string are ASCII, False

Knowledge Graph Retriever

      otherwise.
      ASCII characters have code points in the range U+0000-U+007F.
      Empty string is ASCII too.
   isdecimal()
      Return True if the string is a decimal string, False otherwise.
      A string is a decimal string if all characters in the string are
      decimal and there is at least one character in the string.
   isdigit()
      Return True if the string is a digit string, False otherwise.
      A string is a digit string if all characters in the string are
      digits and there is at least one character in the string.
   isidentifier()
      Return True if the string is a valid Python identifier, False
      otherwise.
      Call keyword.iskeyword(s) to test whether string s is a reserved
      identifier, such as "def" or "class".
   islower()
      Return True if the string is a lowercase string, False
      otherwise.
      A string is lowercase if all cased characters in the string are
      lowercase and there is at least one cased character in the
      string.
   isnumeric()
      Return True if the string is a numeric string, False otherwise.
      A string is numeric if all characters in the string are numeric
      and there is at least one character in the string.
   isprintable()
      Return True if the string is printable, False otherwise.
      A string is printable if all of its characters are considered
      printable in repr() or if it is empty.
   isspace()
      Return True if the string is a whitespace string, False
      otherwise.
      A string is whitespace if all characters in the string are
      whitespace and there is at least one character in the string.
   istitle()
      Return True if the string is a title-cased string, False
      otherwise.
      In a title-cased string, upper- and title-case characters may
      only follow uncased characters and lowercase characters only
      cased ones.
   isupper()
      Return True if the string is an uppercase string, False
      otherwise.
      A string is uppercase if all cased characters in the string are
      uppercase and there is at least one cased character in the
      string.
   join(iterable, /)
      Concatenate any number of strings.
      The string whose method is called is inserted in between each
      given string. The result is returned as a new string.
      Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
   ljust(width, fillchar=' ', /)
      Return a left-justified string of length width.
      Padding is done using the specified fill character (default is a
      space).
   lower()
      Return a copy of the string converted to lowercase.
   lstrip(chars=None, /)
      Return a copy of the string with leading whitespace removed.
      If chars is given and not None, remove characters in chars
      instead.
   static maketrans()
      Return a translation table usable for str.translate().
      If there is only one argument, it must be a dictionary mapping
      Unicode ordinals (integers) or characters to Unicode ordinals,
      strings or None. Character keys will be then converted to
      ordinals. If there are two arguments, they must be strings of
      equal length, and in the resulting dictionary, each character in
      x will be mapped to the character at the same position in y. If
      there is a third argument, it must be a string, whose characters
      will be mapped to None in the result.
   partition(sep, /)
      Partition the string into three parts using the given separator.
      This will search for the separator in the string.  If the
      separator is found, returns a 3-tuple containing the part before
      the separator, the separator itself, and the part after it.

Knowledge Graph Retriever

      If the separator is not found, returns a 3-tuple containing the
      original string and two empty strings.
   removeprefix(prefix, /)
      Return a str with the given prefix string removed if present.
      If the string starts with the prefix string, return
      string[len(prefix):]. Otherwise, return a copy of the original
      string.
   removesuffix(suffix, /)
      Return a str with the given suffix string removed if present.
      If the string ends with the suffix string and that suffix is not
      empty, return string[:-len(suffix)]. Otherwise, return a copy of
      the original string.
   replace(old, new, count=-1, /)
      Return a copy with all occurrences of substring old replaced by
      new.
         count
            Maximum number of occurrences to replace. -1 (the default
            value) means replace all occurrences.
      If the optional argument count is given, only the first count
      occurrences are replaced.
   rfind(sub[, start[, end]]) -> int
      Return the highest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Return -1 on failure.
   rindex(sub[, start[, end]]) -> int
      Return the highest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Raises ValueError when the substring is not found.
   rjust(width, fillchar=' ', /)
      Return a right-justified string of length width.
      Padding is done using the specified fill character (default is a
      space).
   rpartition(sep, /)
      Partition the string into three parts using the given separator.
      This will search for the separator in the string, starting at
      the end. If the separator is found, returns a 3-tuple containing
      the part before the separator, the separator itself, and the
      part after it.
      If the separator is not found, returns a 3-tuple containing two
      empty strings and the original string.
   rsplit(sep=None, maxsplit=-1)
      Return a list of the substrings in the string, using sep as the
      separator string.
         sep
            The separator used to split the string.
            When set to None (the default value), will split on any
            whitespace character (including n r t f and spaces) and
            will discard empty strings from the result.
         maxsplit
            Maximum number of splits (starting from the left). -1 (the
            default value) means no limit.
      Splitting starts at the end of the string and works to the
      front.
   rstrip(chars=None, /)
      Return a copy of the string with trailing whitespace removed.
      If chars is given and not None, remove characters in chars
      instead.
   split(sep=None, maxsplit=-1)
      Return a list of the substrings in the string, using sep as the
      separator string.
         sep
            The separator used to split the string.
            When set to None (the default value), will split on any
            whitespace character (including n r t f and spaces) and
            will discard empty strings from the result.
         maxsplit
            Maximum number of splits (starting from the left). -1 (the
            default value) means no limit.
      Note, str.split() is mainly useful for data that has been
      intentionally delimited.  With natural text that includes
      punctuation, consider using the regular expression module.
   splitlines(keepends=False)
      Return a list of the lines in the string, breaking at line
      boundaries.
      Line breaks are not included in the resulting list unless

Knowledge Graph Retriever

      keepends is given and true.
   startswith(prefix[, start[, end]]) -> bool
      Return True if S starts with the specified prefix, False
      otherwise. With optional start, test S beginning at that
      position. With optional end, stop comparing S at that position.
      prefix can also be a tuple of strings to try.
   strip(chars=None, /)
      Return a copy of the string with leading and trailing whitespace
      removed.
      If chars is given and not None, remove characters in chars
      instead.
   swapcase()
      Convert uppercase characters to lowercase and lowercase
      characters to uppercase.
   title()
      Return a version of the string where each word is titlecased.
      More specifically, words start with uppercased characters and
      all remaining cased characters have lower case.
   translate(table, /)
      Replace each character in the string using the given translation
      table.
         table
            Translation table, which must be a mapping of Unicode
            ordinals to Unicode ordinals, strings, or None.
      The table must implement lookup/indexing via __getitem__, for
      instance a dictionary or list.  If this operation raises
      LookupError, the character is left untouched.  Characters mapped
      to None are deleted.
   upper()
      Return a copy of the string converted to uppercase.
   zfill(width, /)
      Pad a numeric string with zeros on the left, to fill a field of
      the given width.
      The string is never truncated.
class llama_index.indices.knowledge_graph.retrievers.KGTableRetriever(index: KnowledgeGraphIndex, query_keyword_extract_template: Optional[BasePromptTemplate] = None, max_keywords_per_query: int = 10, num_chunks_per_query: int = 10, include_text: bool = True, retriever_mode: Optional[KGRetrieverMode] = KGRetrieverMode.KEYWORD, similarity_top_k: int = 2, graph_store_query_depth: int = 2, use_global_node_triplets: bool = False, max_knowledge_sequence: int = 30, **kwargs: Any)
   KG Table Retriever.
   Arguments are shared among subclasses.
   Parameters:
      * **query_keyword_extract_template**
        (*Optional**[**QueryKGExtractPrompt**]*) -- A Query KG
        Extraction Prompt (see Prompt Templates).
      * **refine_template** (*Optional**[**BasePromptTemplate**]*) --
        A Refinement Prompt (see Prompt Templates).
      * **text_qa_template** (*Optional**[**BasePromptTemplate**]*) --
        A Question Answering Prompt (see Prompt Templates).
      * **max_keywords_per_query** (*int*) -- Maximum number of
        keywords to extract from query.
      * **num_chunks_per_query** (*int*) -- Maximum number of text
        chunks to query.
      * **include_text** (*bool*) -- Use the document text source from
        each relevant triplet during queries.
      * **retriever_mode** (*KGRetrieverMode*) -- Specifies whether to
        use keywords, embeddings, or both to find relevant triplets.
        Should be one of "keyword", "embedding", or "hybrid".
      * **similarity_top_k** (*int*) -- The number of top embeddings
        to use (if embeddings are used).
      * **graph_store_query_depth** (*int*) -- The depth of the graph
        store query.
      * **use_global_node_triplets** (*bool*) -- Whether to get more
        keywords(entities) from text chunks matched by keywords. This
        helps introduce more global knowledge. While it's more
        expensive, thus to be turned off by default.
      * **max_knowledge_sequence** (*int*) -- The maximum number of
        knowledge sequence to include in the response. By default,

Knowledge Graph Retriever

        it's 30.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.
class llama_index.indices.knowledge_graph.retrievers.KnowledgeGraphRAGRetriever(service_context: Optional[ServiceContext] = None, storage_context: Optional[StorageContext] = None, entity_extract_fn: Optional[Callable] = None, entity_extract_template: Optional[BasePromptTemplate] = None, entity_extract_policy: Optional[str] = 'union', synonym_expand_fn: Optional[Callable] = None, synonym_expand_template: Optional[BasePromptTemplate] = None, synonym_expand_policy: Optional[str] = 'union', max_entities: int = 5, max_synonyms: int = 5, retriever_mode: Optional[str] = 'keyword', with_nl2graphquery: bool = False, graph_traversal_depth: int = 2, max_knowledge_sequence: int = 30, verbose: bool = False, **kwargs: Any)
   Knowledge Graph RAG retriever.
   Retriever that perform SubGraph RAG towards knowledge graph.
   Parameters:
      * **service_context** (*Optional**[**ServiceContext**]*) -- A
        service context to use.
      * **storage_context** (*Optional**[**StorageContext**]*) -- A
        storage context to use.
      * **entity_extract_fn** (*Optional**[**Callable**]*) -- A
        function to extract entities.
      * **Optional****[****BasePromptTemplate****]****)**
        (*entity_extract_template*) -- A Query Key Entity Extraction
        Prompt (see Prompt Templates).
      * **entity_extract_policy** (*Optional**[**str**]*) -- The
        entity extraction policy to use. default: "union" possible
        values: "union", "intersection"
      * **synonym_expand_fn** (*Optional**[**Callable**]*) -- A
        function to expand synonyms.
      * **synonym_expand_template**
        (*Optional**[**QueryKeywordExpandPrompt**]*) -- A Query Key
        Entity Expansion Prompt (see Prompt Templates).
      * **synonym_expand_policy** (*Optional**[**str**]*) -- The
        synonym expansion policy to use. default: "union" possible
        values: "union", "intersection"
      * **max_entities** (*int*) -- The maximum number of entities to
        extract. default: 5
      * **max_synonyms** (*int*) -- The maximum number of synonyms to
        expand per entity. default: 5
      * **retriever_mode** (*Optional**[**str**]*) -- The retriever
        mode to use. default: "keyword" possible values: "keyword",
        "embedding", "keyword_embedding"
      * **with_nl2graphquery** (*bool*) -- Whether to combine
        NL2GraphQuery in context. default: False
      * **graph_traversal_depth** (*int*) -- The depth of graph
        traversal. default: 2
      * **max_knowledge_sequence** (*int*) -- The maximum number of
        knowledge sequence to include in the response. By default,
        it's 30.
      * **verbose** (*bool*) -- Whether to print out debug info.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.

Knowledge Graph Retriever


Empty Index Retriever

Default query for EmptyIndex.
class llama_index.indices.empty.retrievers.EmptyIndexRetriever(index: EmptyIndex, input_prompt: Optional[BasePromptTemplate] = None, **kwargs: Any)
   EmptyIndex query.
   Passes the raw LLM call to the underlying LLM model.
   Parameters:
      **input_prompt** (*Optional**[**BasePromptTemplate**]*) -- A
      Simple Input Prompt (see Prompt Templates).
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.


List Retriever

Retrievers for SummaryIndex.
llama_index.indices.list.retrievers.ListIndexEmbeddingRetriever
   alias of "SummaryIndexEmbeddingRetriever"
llama_index.indices.list.retrievers.ListIndexLLMRetriever
   alias of "SummaryIndexLLMRetriever"
llama_index.indices.list.retrievers.ListIndexRetriever
   alias of "SummaryIndexRetriever"
class llama_index.indices.list.retrievers.SummaryIndexEmbeddingRetriever(index: SummaryIndex, similarity_top_k: Optional[int] = 1, **kwargs: Any)
   Embedding based retriever for SummaryIndex.
   Generates embeddings in a lazy fashion for all nodes that are
   traversed.
   Parameters:
      * **index** (*SummaryIndex*) -- The index to retrieve from.
      * **similarity_top_k** (*Optional**[**int**]*) -- The number of
        top nodes to return.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.
class llama_index.indices.list.retrievers.SummaryIndexLLMRetriever(index: SummaryIndex, choice_select_prompt: Optional[PromptTemplate] = None, choice_batch_size: int = 10, format_node_batch_fn: Optional[Callable] = None, parse_choice_select_answer_fn: Optional[Callable] = None, service_context: Optional[ServiceContext] = None, **kwargs: Any)
   LLM retriever for SummaryIndex.
   Parameters:
      * **index** (*SummaryIndex*) -- The index to retrieve from.
      * **choice_select_prompt** (*Optional**[**PromptTemplate**]*) --
        A Choice-Select Prompt (see Prompt Templates).)
      * **choice_batch_size** (*int*) -- The number of nodes to query
        at a time.
      * **format_node_batch_fn** (*Optional**[**Callable**]*) -- A
        function that formats a batch of nodes.
      * **parse_choice_select_answer_fn** (*Optional**[**Callable**]*)
        -- A function that parses the choice select answer.
      * **service_context** (*Optional**[**ServiceContext**]*) -- A
        service context.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.
class llama_index.indices.list.retrievers.SummaryIndexRetriever(index: SummaryIndex, **kwargs: Any)
   Simple retriever for SummaryIndex that returns all nodes.
   Parameters:
      **index** (*SummaryIndex*) -- The index to retrieve from.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.


Vector Store Retrievers

Base vector store index query.
class llama_index.indices.vector_store.retrievers.retriever.VectorIndexRetriever(index: VectorStoreIndex, similarity_top_k: int = 2, vector_store_query_mode: VectorStoreQueryMode = VectorStoreQueryMode.DEFAULT, filters: Optional[MetadataFilters] = None, alpha: Optional[float] = None, node_ids: Optional[List[str]] = None, doc_ids: Optional[List[str]] = None, sparse_top_k: Optional[int] = None, **kwargs: Any)
   Vector index retriever.
   Parameters:
      * **index** (*VectorStoreIndex*) -- vector store index.
      * **similarity_top_k** (*int*) -- number of top k results to
        return.
      * **vector_store_query_mode** (*str*) -- vector store query mode
        See reference for VectorStoreQueryMode for full list of
        supported modes.
      * **filters** (*Optional**[**MetadataFilters**]*) -- metadata
        filters, defaults to None
      * **alpha** (*float*) -- weight for sparse/dense retrieval, only
        used for hybrid query mode.
      * **doc_ids** (*Optional**[**List**[**str**]**]*) -- list of
        documents to constrain search.
      * **vector_store_kwargs** (*dict*) -- Additional vector store
        specific kwargs to pass through to the vector store at query
        time.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.
   property similarity_top_k: int
      Return similarity top k.
class llama_index.indices.vector_store.retrievers.auto_retriever.auto_retriever.VectorIndexAutoRetriever(index: VectorStoreIndex, vector_store_info: VectorStoreInfo, prompt_template_str: Optional[str] = None, service_context: Optional[ServiceContext] = None, max_top_k: int = 10, similarity_top_k: int = 2, vector_store_query_mode: VectorStoreQueryMode = VectorStoreQueryMode.DEFAULT, **kwargs: Any)
   Vector store auto retriever.
   A retriever for vector store index that uses an LLM to
   automatically set vector store query parameters.
   Parameters:
      * **index** (*VectorStoreIndex*) -- vector store index
      * **vector_store_info** (*VectorStoreInfo*) -- additional
        information information about vector store content and
        supported metadata filters. The natural language description
        is used by an LLM to automatically set vector store query
        parameters.
      * **prompt_template_str** -- custom prompt template string for
        LLM. Uses default template string if None.
      * **service_context** -- service context containing reference to
        LLMPredictor. Uses service context from index be default if
        None.
      * **similarity_top_k** (*int*) -- number of top k results to
        return.
      * **max_top_k** (*int*) -- the maximum top_k allowed. The top_k
        set by LLM or similarity_top_k will be clamped to this value.
      * **vector_store_query_mode** (*str*) -- vector store query mode
        See reference for VectorStoreQueryMode for full list of
        supported modes.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]

Vector Store Retrievers

      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.
Vector store index types.
pydantic model llama_index.vector_stores.types.BasePydanticVectorStore
   Abstract vector store protocol.
      {
         "title": "BasePydanticVectorStore",
         "description": "Abstract vector store protocol.",
         "type": "object",
         "properties": {
            "stores_text": {
               "title": "Stores Text",
               "type": "boolean"
            },
            "is_embedding_query": {
               "title": "Is Embedding Query",
               "default": true,
               "type": "boolean"
            }
         },
         "required": [
            "stores_text"
         ]
      }
   Fields:
      * "is_embedding_query (bool)"
      * "stores_text (bool)"
   field is_embedding_query: bool = True
   field stores_text: bool [Required]
   abstract add(nodes: List[BaseNode]) -> List[str]
      Add nodes to vector store.
   async adelete(ref_doc_id: str, **delete_kwargs: Any) -> None
      Delete nodes using with ref_doc_id. NOTE: this is not
      implemented for all vector stores. If not implemented, it will
      just call delete synchronously.
   async aquery(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
      Asynchronously query vector store. NOTE: this is not implemented
      for all vector stores. If not implemented, it will just call
      query synchronously.
   async async_add(nodes: List[BaseNode]) -> List[str]
      Asynchronously add nodes to vector store. NOTE: this is not
      implemented for all vector stores. If not implemented, it will
      just call add synchronously.
   abstract classmethod class_name() -> str
      Get the class name, used as a unique ID in serialization.
      This provides a key that makes serialization robust against
      actual class name changes.
   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 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 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 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
   abstract delete(ref_doc_id: str, **delete_kwargs: Any) -> None
      Delete nodes using with ref_doc_id.
   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, exclude_defaults: bool = False, exclude_none: bool = False) -> DictStrAny

Vector Store Retrievers

      Generate a dictionary representation of the model, optionally
      specifying which fields to include or exclude.
   classmethod from_dict(data: Dict[str, Any], **kwargs: Any) -> Self
   classmethod from_json(data_str: str, **kwargs: Any) -> Self
   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_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) -> unicode
      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 = 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: Protocol = None, allow_pickle: bool = False) -> Model
   persist(persist_path: str, fs: Optional[AbstractFileSystem] = None) -> None
   abstract query(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
      Query vector store.
   classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') -> DictStrAny
   classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) -> unicode
   to_dict(**kwargs: Any) -> Dict[str, Any]
   to_json(**kwargs: Any) -> str
   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
   abstract property client: Any
      Get client.
pydantic model llama_index.vector_stores.types.ExactMatchFilter
   Exact match metadata filter for vector stores.
   Value uses Strict* types, as int, float and str are compatible
   types and were all converted to string before.
   See: https://docs.pydantic.dev/latest/usage/types/#strict-types
      {
         "title": "ExactMatchFilter",
         "description": "Exact match metadata filter for vector stores.\n\nValue uses Strict* types, as int, float and str are compatible types and were all\nconverted to string before.\n\nSee: https://docs.pydantic.dev/latest/usage/types/#strict-types",
         "type": "object",
         "properties": {
            "key": {
               "title": "Key",
               "type": "string"
            },
            "value": {
               "title": "Value",
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  }
               ]
            }
         },
         "required": [
            "key",
            "value"
         ]
      }
   Fields:
      * "key (str)"
      * "value (Union[pydantic.types.StrictInt,
        pydantic.types.StrictFloat, pydantic.types.StrictStr])"

Vector Store Retrievers

   field key: str [Required]
   field value: Union[StrictInt, StrictFloat, StrictStr] [Required]
   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 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 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 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(*, 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_none: bool = False) -> DictStrAny
      Generate a dictionary representation of the model, optionally
      specifying which fields to include or exclude.
   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_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) -> unicode
      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 = 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: Protocol = None, allow_pickle: bool = False) -> Model
   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 fields based on this Model,
      globalns and localns.
   classmethod validate(value: Any) -> Model
pydantic model llama_index.vector_stores.types.MetadataFilters
   Metadata filters for vector stores.

Vector Store Retrievers

   Currently only supports exact match filters. TODO: support more
   advanced expressions.
      {
         "title": "MetadataFilters",
         "description": "Metadata filters for vector stores.\n\nCurrently only supports exact match filters.\nTODO: support more advanced expressions.",
         "type": "object",
         "properties": {
            "filters": {
               "title": "Filters",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/ExactMatchFilter"
               }
            }
         },
         "required": [
            "filters"
         ],
         "definitions": {
            "ExactMatchFilter": {
               "title": "ExactMatchFilter",
               "description": "Exact match metadata filter for vector stores.\n\nValue uses Strict* types, as int, float and str are compatible types and were all\nconverted to string before.\n\nSee: https://docs.pydantic.dev/latest/usage/types/#strict-types",
               "type": "object",
               "properties": {
                  "key": {
                     "title": "Key",
                     "type": "string"
                  },
                  "value": {
                     "title": "Value",
                     "anyOf": [
                        {
                           "type": "integer"
                        },
                        {
                           "type": "number"
                        },
                        {
                           "type": "string"
                        }
                     ]
                  }
               },
               "required": [
                  "key",
                  "value"
               ]
            }
         }
      }
   Fields:
      * "filters
        (List[llama_index.vector_stores.types.ExactMatchFilter])"
   field filters: List[ExactMatchFilter] [Required]
   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 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 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 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(*, 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_none: bool = False) -> DictStrAny
      Generate a dictionary representation of the model, optionally
      specifying which fields to include or exclude.
   classmethod from_dict(filter_dict: Dict) -> MetadataFilters
      Create MetadataFilters from json.
   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_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) -> unicode

Vector Store Retrievers

      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 = 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: Protocol = None, allow_pickle: bool = False) -> Model
   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 fields based on this Model,
      globalns and localns.
   classmethod validate(value: Any) -> Model
pydantic model llama_index.vector_stores.types.MetadataInfo
   Information about a metadata filter supported by a vector store.
   Currently only used by VectorIndexAutoRetriever.
      {
         "title": "MetadataInfo",
         "description": "Information about a metadata filter supported by a vector store.\n\nCurrently only used by VectorIndexAutoRetriever.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "type": "string"
            }
         },
         "required": [
            "name",
            "type",
            "description"
         ]
      }
   Fields:
      * "description (str)"
      * "name (str)"
      * "type (str)"
   field description: str [Required]
   field name: str [Required]
   field type: str [Required]
   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 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 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 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(*, 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_none: bool = False) -> DictStrAny

Vector Store Retrievers

      Generate a dictionary representation of the model, optionally
      specifying which fields to include or exclude.
   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_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) -> unicode
      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 = 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: Protocol = None, allow_pickle: bool = False) -> Model
   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 fields based on this Model,
      globalns and localns.
   classmethod validate(value: Any) -> Model
pydantic model llama_index.vector_stores.types.VectorStoreInfo
   Information about a vector store (content and supported metadata
   filters).
   Currently only used by VectorIndexAutoRetriever.
      {
         "title": "VectorStoreInfo",
         "description": "Information about a vector store (content and supported metadata filters).\n\nCurrently only used by VectorIndexAutoRetriever.",
         "type": "object",
         "properties": {
            "metadata_info": {
               "title": "Metadata Info",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/MetadataInfo"
               }
            },
            "content_info": {
               "title": "Content Info",
               "type": "string"
            }
         },
         "required": [
            "metadata_info",
            "content_info"
         ],
         "definitions": {
            "MetadataInfo": {
               "title": "MetadataInfo",
               "description": "Information about a metadata filter supported by a vector store.\n\nCurrently only used by VectorIndexAutoRetriever.",
               "type": "object",
               "properties": {
                  "name": {
                     "title": "Name",
                     "type": "string"
                  },
                  "type": {
                     "title": "Type",
                     "type": "string"
                  },
                  "description": {
                     "title": "Description",
                     "type": "string"
                  }
               },
               "required": [
                  "name",
                  "type",
                  "description"
               ]
            }
         }
      }
   Fields:
      * "content_info (str)"
      * "metadata_info
        (List[llama_index.vector_stores.types.MetadataInfo])"
   field content_info: str [Required]
   field metadata_info: List[MetadataInfo] [Required]
   classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) -> Model

Vector Store Retrievers

      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, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) -> Model
      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 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(*, 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_none: bool = False) -> DictStrAny
      Generate a dictionary representation of the model, optionally
      specifying which fields to include or exclude.
   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_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) -> unicode
      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 = 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: Protocol = None, allow_pickle: bool = False) -> Model
   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 fields based on this Model,
      globalns and localns.
   classmethod validate(value: Any) -> Model
class llama_index.vector_stores.types.VectorStoreQueryMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
   Vector store query mode.
   capitalize()
      Return a capitalized version of the string.
      More specifically, make the first character have upper case and
      the rest lower case.

Vector Store Retrievers

   casefold()
      Return a version of the string suitable for caseless
      comparisons.
   center(width, fillchar=' ', /)
      Return a centered string of length width.
      Padding is done using the specified fill character (default is a
      space).
   count(sub[, start[, end]]) -> int
      Return the number of non-overlapping occurrences of substring
      sub in string S[start:end].  Optional arguments start and end
      are interpreted as in slice notation.
   encode(encoding='utf-8', errors='strict')
      Encode the string using the codec registered for encoding.
      encoding
         The encoding in which to encode the string.
      errors
         The error handling scheme to use for encoding errors. The
         default is 'strict' meaning that encoding errors raise a
         UnicodeEncodeError.  Other possible values are 'ignore',
         'replace' and 'xmlcharrefreplace' as well as any other name
         registered with codecs.register_error that can handle
         UnicodeEncodeErrors.
   endswith(suffix[, start[, end]]) -> bool
      Return True if S ends with the specified suffix, False
      otherwise. With optional start, test S beginning at that
      position. With optional end, stop comparing S at that position.
      suffix can also be a tuple of strings to try.
   expandtabs(tabsize=8)
      Return a copy where all tab characters are expanded using
      spaces.
      If tabsize is not given, a tab size of 8 characters is assumed.
   find(sub[, start[, end]]) -> int
      Return the lowest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Return -1 on failure.
   format(*args, **kwargs) -> str
      Return a formatted version of S, using substitutions from args
      and kwargs. The substitutions are identified by braces ('{' and
      '}').
   format_map(mapping) -> str
      Return a formatted version of S, using substitutions from
      mapping. The substitutions are identified by braces ('{' and
      '}').
   index(sub[, start[, end]]) -> int
      Return the lowest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Raises ValueError when the substring is not found.
   isalnum()
      Return True if the string is an alpha-numeric string, False
      otherwise.
      A string is alpha-numeric if all characters in the string are
      alpha-numeric and there is at least one character in the string.
   isalpha()
      Return True if the string is an alphabetic string, False
      otherwise.
      A string is alphabetic if all characters in the string are
      alphabetic and there is at least one character in the string.
   isascii()
      Return True if all characters in the string are ASCII, False
      otherwise.
      ASCII characters have code points in the range U+0000-U+007F.
      Empty string is ASCII too.
   isdecimal()
      Return True if the string is a decimal string, False otherwise.
      A string is a decimal string if all characters in the string are
      decimal and there is at least one character in the string.
   isdigit()
      Return True if the string is a digit string, False otherwise.
      A string is a digit string if all characters in the string are
      digits and there is at least one character in the string.
   isidentifier()
      Return True if the string is a valid Python identifier, False
      otherwise.
      Call keyword.iskeyword(s) to test whether string s is a reserved
      identifier, such as "def" or "class".

Vector Store Retrievers

   islower()
      Return True if the string is a lowercase string, False
      otherwise.
      A string is lowercase if all cased characters in the string are
      lowercase and there is at least one cased character in the
      string.
   isnumeric()
      Return True if the string is a numeric string, False otherwise.
      A string is numeric if all characters in the string are numeric
      and there is at least one character in the string.
   isprintable()
      Return True if the string is printable, False otherwise.
      A string is printable if all of its characters are considered
      printable in repr() or if it is empty.
   isspace()
      Return True if the string is a whitespace string, False
      otherwise.
      A string is whitespace if all characters in the string are
      whitespace and there is at least one character in the string.
   istitle()
      Return True if the string is a title-cased string, False
      otherwise.
      In a title-cased string, upper- and title-case characters may
      only follow uncased characters and lowercase characters only
      cased ones.
   isupper()
      Return True if the string is an uppercase string, False
      otherwise.
      A string is uppercase if all cased characters in the string are
      uppercase and there is at least one cased character in the
      string.
   join(iterable, /)
      Concatenate any number of strings.
      The string whose method is called is inserted in between each
      given string. The result is returned as a new string.
      Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
   ljust(width, fillchar=' ', /)
      Return a left-justified string of length width.
      Padding is done using the specified fill character (default is a
      space).
   lower()
      Return a copy of the string converted to lowercase.
   lstrip(chars=None, /)
      Return a copy of the string with leading whitespace removed.
      If chars is given and not None, remove characters in chars
      instead.
   static maketrans()
      Return a translation table usable for str.translate().
      If there is only one argument, it must be a dictionary mapping
      Unicode ordinals (integers) or characters to Unicode ordinals,
      strings or None. Character keys will be then converted to
      ordinals. If there are two arguments, they must be strings of
      equal length, and in the resulting dictionary, each character in
      x will be mapped to the character at the same position in y. If
      there is a third argument, it must be a string, whose characters
      will be mapped to None in the result.
   partition(sep, /)
      Partition the string into three parts using the given separator.
      This will search for the separator in the string.  If the
      separator is found, returns a 3-tuple containing the part before
      the separator, the separator itself, and the part after it.
      If the separator is not found, returns a 3-tuple containing the
      original string and two empty strings.
   removeprefix(prefix, /)
      Return a str with the given prefix string removed if present.
      If the string starts with the prefix string, return
      string[len(prefix):]. Otherwise, return a copy of the original
      string.
   removesuffix(suffix, /)
      Return a str with the given suffix string removed if present.
      If the string ends with the suffix string and that suffix is not
      empty, return string[:-len(suffix)]. Otherwise, return a copy of
      the original string.
   replace(old, new, count=-1, /)
      Return a copy with all occurrences of substring old replaced by
      new.
         count

Vector Store Retrievers

            Maximum number of occurrences to replace. -1 (the default
            value) means replace all occurrences.
      If the optional argument count is given, only the first count
      occurrences are replaced.
   rfind(sub[, start[, end]]) -> int
      Return the highest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Return -1 on failure.
   rindex(sub[, start[, end]]) -> int
      Return the highest index in S where substring sub is found, such
      that sub is contained within S[start:end].  Optional arguments
      start and end are interpreted as in slice notation.
      Raises ValueError when the substring is not found.
   rjust(width, fillchar=' ', /)
      Return a right-justified string of length width.
      Padding is done using the specified fill character (default is a
      space).
   rpartition(sep, /)
      Partition the string into three parts using the given separator.
      This will search for the separator in the string, starting at
      the end. If the separator is found, returns a 3-tuple containing
      the part before the separator, the separator itself, and the
      part after it.
      If the separator is not found, returns a 3-tuple containing two
      empty strings and the original string.
   rsplit(sep=None, maxsplit=-1)
      Return a list of the substrings in the string, using sep as the
      separator string.
         sep
            The separator used to split the string.
            When set to None (the default value), will split on any
            whitespace character (including n r t f and spaces) and
            will discard empty strings from the result.
         maxsplit
            Maximum number of splits (starting from the left). -1 (the
            default value) means no limit.
      Splitting starts at the end of the string and works to the
      front.
   rstrip(chars=None, /)
      Return a copy of the string with trailing whitespace removed.
      If chars is given and not None, remove characters in chars
      instead.
   split(sep=None, maxsplit=-1)
      Return a list of the substrings in the string, using sep as the
      separator string.
         sep
            The separator used to split the string.
            When set to None (the default value), will split on any
            whitespace character (including n r t f and spaces) and
            will discard empty strings from the result.
         maxsplit
            Maximum number of splits (starting from the left). -1 (the
            default value) means no limit.
      Note, str.split() is mainly useful for data that has been
      intentionally delimited.  With natural text that includes
      punctuation, consider using the regular expression module.
   splitlines(keepends=False)
      Return a list of the lines in the string, breaking at line
      boundaries.
      Line breaks are not included in the resulting list unless
      keepends is given and true.
   startswith(prefix[, start[, end]]) -> bool
      Return True if S starts with the specified prefix, False
      otherwise. With optional start, test S beginning at that
      position. With optional end, stop comparing S at that position.
      prefix can also be a tuple of strings to try.
   strip(chars=None, /)
      Return a copy of the string with leading and trailing whitespace
      removed.
      If chars is given and not None, remove characters in chars
      instead.
   swapcase()
      Convert uppercase characters to lowercase and lowercase
      characters to uppercase.
   title()
      Return a version of the string where each word is titlecased.
      More specifically, words start with uppercased characters and

Vector Store Retrievers

      all remaining cased characters have lower case.
   translate(table, /)
      Replace each character in the string using the given translation
      table.
         table
            Translation table, which must be a mapping of Unicode
            ordinals to Unicode ordinals, strings, or None.
      The table must implement lookup/indexing via __getitem__, for
      instance a dictionary or list.  If this operation raises
      LookupError, the character is left untouched.  Characters mapped
      to None are deleted.
   upper()
      Return a copy of the string converted to uppercase.
   zfill(width, /)
      Pad a numeric string with zeros on the left, to fill a field of
      the given width.
      The string is never truncated.


Keyword Table Retrievers

Query for KeywordTableIndex.
class llama_index.indices.keyword_table.retrievers.BaseKeywordTableRetriever(index: BaseKeywordTableIndex, keyword_extract_template: Optional[BasePromptTemplate] = None, query_keyword_extract_template: Optional[BasePromptTemplate] = None, max_keywords_per_query: int = 10, num_chunks_per_query: int = 10, **kwargs: Any)
   Base Keyword Table Retriever.
   Arguments are shared among subclasses.
   Parameters:
      * **keyword_extract_template**
        (*Optional**[**BasePromptTemplate**]*) -- A Keyword Extraction
        Prompt (see Prompt Templates).
      * **query_keyword_extract_template**
        (*Optional**[**BasePromptTemplate**]*) -- A Query Keyword
        Extraction Prompt (see Prompt Templates).
      * **refine_template** (*Optional**[**BasePromptTemplate**]*) --
        A Refinement Prompt (see Prompt Templates).
      * **text_qa_template** (*Optional**[**BasePromptTemplate**]*) --
        A Question Answering Prompt (see Prompt Templates).
      * **max_keywords_per_query** (*int*) -- Maximum number of
        keywords to extract from query.
      * **num_chunks_per_query** (*int*) -- Maximum number of text
        chunks to query.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.
class llama_index.indices.keyword_table.retrievers.KeywordTableGPTRetriever(index: BaseKeywordTableIndex, keyword_extract_template: Optional[BasePromptTemplate] = None, query_keyword_extract_template: Optional[BasePromptTemplate] = None, max_keywords_per_query: int = 10, num_chunks_per_query: int = 10, **kwargs: Any)
   Keyword Table Index GPT Retriever.
   Extracts keywords using GPT. Set when using
   *retriever_mode="default"*.
   See BaseGPTKeywordTableQuery for arguments.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.
class llama_index.indices.keyword_table.retrievers.KeywordTableRAKERetriever(index: BaseKeywordTableIndex, keyword_extract_template: Optional[BasePromptTemplate] = None, query_keyword_extract_template: Optional[BasePromptTemplate] = None, max_keywords_per_query: int = 10, num_chunks_per_query: int = 10, **kwargs: Any)
   Keyword Table Index RAKE Retriever.
   Extracts keywords using RAKE keyword extractor. Set when
   *retriever_mode="rake"*.
   See BaseGPTKeywordTableQuery for arguments.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.
class llama_index.indices.keyword_table.retrievers.KeywordTableSimpleRetriever(index: BaseKeywordTableIndex, keyword_extract_template: Optional[BasePromptTemplate] = None, query_keyword_extract_template: Optional[BasePromptTemplate] = None, max_keywords_per_query: int = 10, num_chunks_per_query: int = 10, **kwargs: Any)

Keyword Table Retrievers

   Keyword Table Index Simple Retriever.
   Extracts keywords using simple regex-based keyword extractor. Set
   when *retriever_mode="simple"*.
   See BaseGPTKeywordTableQuery for arguments.
   get_service_context() -> Optional[ServiceContext]
      Attempts to resolve a service context. Short-circuits at
      self.service_context, self._service_context, or
      self._index.service_context.
   retrieve(str_or_query_bundle: Union[str, QueryBundle]) -> List[NodeWithScore]
      Retrieve nodes given query.
      Parameters:
         **str_or_query_bundle** (*QueryType*) -- Either a query
         string or a QueryBundle object.