HANAMLinVectorEngine
- class hana_ai.vectorstore.hana_vector_engine.HANAMLinVectorEngine(connection_context, table_name, schema=None, model_version='SAP_NEB.20240715')
HANA vector engine.
- Parameters:
- connection_context: ConnectionContext
Connection context.
- table_name: str
Table name. Table/schema names cannot contain single or double quotes, NUL bytes or semicolons; ordinary case-sensitive names are supported.
- schema: str, optional
Schema name. Default to None.
- model_version: str, optional
Model version. Default to 'SAP_NEB.20240715'. NUL bytes and semicolons are rejected; apostrophes in values are safely encoded.
- get_knowledge()
Get knowledge dataframe.
- create_knowledge(option='python')
Create knowledge base.
- Parameters:
- option: {'python', 'sql'}, optional
The option of language. Default to 'python'.
- upsert_knowledge(knowledge)
Upsert knowledge.
- Parameters:
- knowledge: dict
Knowledge data. {'id': '1', 'description': 'description', 'example': 'example'}
- query(input, top_n=1, distance='cosine_similarity')
Query.
- Parameters:
- input: str
Query text. Apostrophes are supported; NUL bytes and semicolons are rejected because hana-ml splits SQL text before parsing quotes.
- top_n: int, optional
Query limit and 1-based result rank, from 1 to 1000. Default to 1.
- distance: str, optional
Case-insensitive function name: COSINE_SIMILARITY, L2DISTANCE, EUCLIDEAN_DISTANCE, DOT_PRODUCT, MANHATTAN_DISTANCE or INNER_PRODUCT. Default to 'cosine_similarity'. The selected function must also be supported by the target HANA database.
- Returns:
- str
Template text at the requested rank, or the last available rank when fewer rows match. This method does not return a result list.