LayerThis notebook demonstrates the process of retrieving Cube's data model metadata in a format suitable for passing to LLMs as embeddings, thereby enhancing contextual information.About Cube‚ÄãCube is the Semantic Layer for building data apps. It helps data engineers and application developers access data from modern data stores, organize it into consistent definitions, and deliver it to every application.Cube‚Äôs data model provides structure and definitions that are used as a context for LLM to understand data and generate correct queries. LLM doesn‚Äôt need to navigate complex joins and metrics calculations because Cube abstracts those and provides a simple interface that operates on the business-level terminology, instead of SQL table and column names. This simplification helps LLM to be less error-prone and avoid hallucinations.Example‚ÄãInput arguments (mandatory)Cube Semantic Loader requires 2 arguments:cube_api_url: The URL of your Cube's deployment REST API. Please refer to the Cube documentation for more information on configuring the base path.cube_api_token: The authentication token generated based on your Cube's API secret. Please refer to the Cube documentation for instructions on generating JSON Web Tokens (JWT).Input arguments (optional)load_dimension_values: Whether to load dimension values for every string dimension or not.dimension_values_limit: Maximum number of dimension values to load.dimension_values_max_retries: Maximum number of retries to load dimension values.dimension_values_retry_delay: Delay between retries to load dimension values.import jwtfrom langchain.document_loaders import CubeSemanticLoaderapi_url = "https://api-example.gcp-us-central1.cubecloudapp.dev/cubejs-api/v1/meta"cubejs_api_secret = "api-secret-here"security_context = {}# Read more about security context here: https://cube.dev/docs/securityapi_token = jwt.encode(security_context, cubejs_api_secret, algorithm="HS256")loader = CubeSemanticLoader(api_url,
This notebook demonstrates the process of retrieving Cube's data model metadata in a format suitable for passing to LLMs as embeddings, thereby enhancing contextual information.
This notebook demonstrates the process of retrieving Cube's data model metadata in a format suitable for passing to LLMs as embeddings, thereby enhancing contextual information. ->: LayerThis notebook demonstrates the process of retrieving Cube's data model metadata in a format suitable for passing to LLMs as embeddings, thereby enhancing contextual information.About Cube‚ÄãCube is the Semantic Layer for building data apps. It helps data engineers and application developers access data from modern data stores, organize it into consistent definitions, and deliver it to every application.Cube‚Äôs data model provides structure and definitions that are used as a context for LLM to understand data and generate correct queries. LLM doesn‚Äôt need to navigate complex joins and metrics calculations because Cube abstracts those and provides a simple interface that operates on the business-level terminology, instead of SQL table and column names. This simplification helps LLM to be less error-prone and avoid hallucinations.Example‚ÄãInput arguments (mandatory)Cube Semantic Loader requires 2 arguments:cube_api_url: The URL of your Cube's deployment REST API. Please refer to the Cube documentation for more information on configuring the base path.cube_api_token: The authentication token generated based on your Cube's API secret. Please refer to the Cube documentation for instructions on generating JSON Web Tokens (JWT).Input arguments (optional)load_dimension_values: Whether to load dimension values for every string dimension or not.dimension_values_limit: Maximum number of dimension values to load.dimension_values_max_retries: Maximum number of retries to load dimension values.dimension_values_retry_delay: Delay between retries to load dimension values.import jwtfrom langchain.document_loaders import CubeSemanticLoaderapi_url = "https://api-example.gcp-us-central1.cubecloudapp.dev/cubejs-api/v1/meta"cubejs_api_secret = "api-secret-here"security_context = {}# Read more about security context here: https://cube.dev/docs/securityapi_token = jwt.encode(security_context, cubejs_api_secret, algorithm="HS256")loader = CubeSemanticLoader(api_url,