Infinispan#
- class langchain_community.vectorstores.infinispanvs.Infinispan(schema: str = 'http', user: str = '', password: str = '', hosts: List[str] = ['127.0.0.1:11222'], cache_url: str = '/rest/v2/caches', schema_url: str = '/rest/v2/schemas', use_post_for_query: bool = True, http2: bool = True, verify: bool = True, **kwargs: Any)[source]#
Helper class for Infinispan REST interface.
This class exposes the Infinispan operations needed to create and set up a vector db.
You need a running Infinispan (15+) server without authentication. You can easily start one, see: rigazilla/infinispan-vector
- Parameters:
schema (str) – Schema for HTTP request: “http” or “https”. Default “http”
user (str) – User and password if auth is required. Default None
password (str) – User and password if auth is required. Default None
hosts (List[str]) – List of server addresses. Default [“127.0.0.1:11222”]
cache_url (str) – URL endpoint for cache API. Default “/rest/v2/caches”
schema_url (str) – URL endpoint for schema API. Default “/rest/v2/schemas”
use_post_for_query (bool) – Whether POST method should be used for query. Default True
http2 (bool) – Whether HTTP/2 protocol should be used. pip install “httpx[http2]” is needed for HTTP/2. Default True
verify (bool) – Whether TLS certificate must be verified. Default True
kwargs (Any)
Methods
__init__
([schema, user, password, hosts, ...])cache_clear
(cache_name)Clear a cache :param cache_name: name of the cache.
cache_delete
(name)Delete a cache :param name: name of the cache.
cache_exists
(cache_name)Check if a cache exists :param cache_name: name of the cache.
cache_post
(name, config)Create a cache :param name: name of the cache.
get
(key, cache_name)Get an entry :param key: key of the entry :type key: str :param cache_name: target cache :type cache_name: str
index_clear
(cache_name)Clear an index on a cache :param cache_name: name of the cache.
index_reindex
(cache_name)Rebuild index on a cache :param cache_name: name of the cache.
post
(key, data, cache_name)Post an entry :param key: key of the entry :type key: str :param data: content of the entry in json format :type data: str :param cache_name: target cache :type cache_name: str
put
(key, data, cache_name)Put an entry :param key: key of the entry :type key: str :param data: content of the entry in json format :type data: str :param cache_name: target cache :type cache_name: str
req_query
(query, cache_name[, local])Request a query :param query: query requested :type query: str :param cache_name: name of the target cache :type cache_name: str :param local: whether the query is local to clustered :type local: boolean
resource_exists
(api_url)Check if a resource exists :param api_url: url of the resource.
schema_delete
(name)Delete a schema :param name: name of the schema.
schema_post
(name, proto)Deploy a schema :param name: name of the schema.
- __init__(schema: str = 'http', user: str = '', password: str = '', hosts: List[str] = ['127.0.0.1:11222'], cache_url: str = '/rest/v2/caches', schema_url: str = '/rest/v2/schemas', use_post_for_query: bool = True, http2: bool = True, verify: bool = True, **kwargs: Any)[source]#
- Parameters:
schema (str) – Schema for HTTP request: “http” or “https”. Default “http”
user (str) – User and password if auth is required. Default None
password (str) – User and password if auth is required. Default None
hosts (List[str]) – List of server addresses. Default [“127.0.0.1:11222”]
cache_url (str) – URL endpoint for cache API. Default “/rest/v2/caches”
schema_url (str) – URL endpoint for schema API. Default “/rest/v2/schemas”
use_post_for_query (bool) – Whether POST method should be used for query. Default True
http2 (bool) – Whether HTTP/2 protocol should be used. pip install “httpx[http2]” is needed for HTTP/2. Default True
verify (bool) – Whether TLS certificate must be verified. Default True
kwargs (Any)
- cache_clear(cache_name: str) Response [source]#
Clear a cache :param cache_name: name of the cache. :type cache_name: str
- Returns:
An http Response containing the result of the operation
- Parameters:
cache_name (str)
- Return type:
Response
- cache_delete(name: str) Response [source]#
Delete a cache :param name: name of the cache. :type name: str
- Returns:
An http Response containing the result of the operation
- Parameters:
name (str)
- Return type:
Response
- cache_exists(cache_name: str) bool [source]#
Check if a cache exists :param cache_name: name of the cache. :type cache_name: str
- Returns:
True if cache exists
- Parameters:
cache_name (str)
- Return type:
bool
- cache_post(name: str, config: str) Response [source]#
Create a cache :param name: name of the cache. :type name: str :param config: configuration of the cache. :type config: str
- Returns:
An http Response containing the result of the operation
- Parameters:
name (str)
config (str)
- Return type:
Response
- get(key: str, cache_name: str) Response [source]#
Get an entry :param key: key of the entry :type key: str :param cache_name: target cache :type cache_name: str
- Returns:
An http Response containing the entry or errors
- Parameters:
key (str)
cache_name (str)
- Return type:
Response
- index_clear(cache_name: str) Response [source]#
Clear an index on a cache :param cache_name: name of the cache. :type cache_name: str
- Returns:
An http Response containing the result of the operation
- Parameters:
cache_name (str)
- Return type:
Response
- index_reindex(cache_name: str) Response [source]#
Rebuild index on a cache :param cache_name: name of the cache. :type cache_name: str
- Returns:
An http Response containing the result of the operation
- Parameters:
cache_name (str)
- Return type:
Response
- post(key: str, data: str, cache_name: str) Response [source]#
Post an entry :param key: key of the entry :type key: str :param data: content of the entry in json format :type data: str :param cache_name: target cache :type cache_name: str
- Returns:
An http Response containing the result of the operation
- Parameters:
key (str)
data (str)
cache_name (str)
- Return type:
Response
- put(key: str, data: str, cache_name: str) Response [source]#
Put an entry :param key: key of the entry :type key: str :param data: content of the entry in json format :type data: str :param cache_name: target cache :type cache_name: str
- Returns:
An http Response containing the result of the operation
- Parameters:
key (str)
data (str)
cache_name (str)
- Return type:
Response
- req_query(query: str, cache_name: str, local: bool = False) Response [source]#
Request a query :param query: query requested :type query: str :param cache_name: name of the target cache :type cache_name: str :param local: whether the query is local to clustered :type local: boolean
- Returns:
An http Response containing the result set or errors
- Parameters:
query (str)
cache_name (str)
local (bool)
- Return type:
Response
- resource_exists(api_url: str) bool [source]#
Check if a resource exists :param api_url: url of the resource. :type api_url: str
- Returns:
true if resource exists
- Parameters:
api_url (str)
- Return type:
bool
- schema_delete(name: str) Response [source]#
Delete a schema :param name: name of the schema. :type name: str
- Returns:
An http Response containing the result of the operation
- Parameters:
name (str)
- Return type:
Response
- schema_post(name: str, proto: str) Response [source]#
Deploy a schema :param name: name of the schema. Will be used as a key :type name: str :param proto: protobuf schema :type proto: str
- Returns:
An http Response containing the result of the operation
- Parameters:
name (str)
proto (str)
- Return type:
Response