mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-09 19:35:20 +03:00
We've started to receive feedback (after launch) that using only views is confusing. We're considering this as a good practice, as a view serves as a "facade" for your data - however, we decided to let users decide this on their own. Solves the questions from: - https://github.com/cube-js/cube/issues/7028 - https://github.com/langchain-ai/langchain/pull/9690
4.7 KiB
4.7 KiB
In [ ]:
import jwt
from langchain.document_loaders import CubeSemanticLoader
api_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/security
api_token = jwt.encode(security_context, cubejs_api_secret, algorithm="HS256")
loader = CubeSemanticLoader(api_url, api_token)
documents = loader.load()In [ ]:
# Given string containing page content
page_content = 'Users View City, None'
# Given dictionary containing metadata
metadata = {
'table_name': 'users_view',
'column_name': 'users_view.city',
'column_data_type': 'string',
'column_title': 'Users View City',
'column_description': 'None',
'column_member_type': 'dimension',
'column_values': [
'Austin',
'Chicago',
'Los Angeles',
'Mountain View',
'New York',
'Palo Alto',
'San Francisco',
'Seattle'
],
'cube_data_obj_type': 'view'
}