databricks-demos / dbdemos

Demos to implement your Databricks Lakehouse
Other
286 stars 96 forks source link

VectorIndexIssue with 1/ Data preparation for LLM Chatbot RAG #124

Open SiddyP opened 6 months ago

SiddyP commented 6 months ago

Running the tutorial as-is doesn't seem to work properly. Attempting to create vector index with below name fails index name: user_siddy_persson.rag_chatbot.databricks_documentation_vs_index

DLT-error: Failed to resolve flow: '__online_index_view'.

With the underlying error:

java.lang.Exception: Error: Response Code: 400, Response: {"error_code":"INVALID_PARAMETER_VALUE","message":"Failed to call Model Serving endpoint: bge-small-en."}

Stacktrace in the notebook:

Exception: Response content b'{"error_code":"INVALID_PARAMETER_VALUE","message":"Invalid index name. Must specify the full index name <catalog>.<schema>.<table>. Only alphanumerics and underscores are allowed."}', status_code 400

Changing the index name appears so solve the issue, e.g.: documentationindex works. Meaning my fully qualified index resource in UC becomes user_siddy_persson.rag_chatbot.documentationindex

Also, I think it'd be useful to clarify even further that the embedding endpoint is expected to exist in the workspace (and can't start with databricks_)

nipundavidnagarro commented 1 month ago

I am having same issue :\

were you able to fix this ?

QuentinAmbard commented 1 month ago

hey, you should be using databricks-gte-large-en instead, I'll send an update, gte should be available in most regions

nipundavidnagarro commented 1 month ago

Nope, discovered it (after 3 hrs) - These databricks guys seriously need to update the documentation here - https://ai-cookbook.io/10-min-demo/mosaic-ai-agents-demo-dbx-notebook.html

chain_config = { "llm_model_serving_endpoint_name": "databricks-dbrx-instruct", # the foundation model we want to use "vector_search_endpoint_name": VECTOR_SEARCH_ENDPOINT, # Endoint for vector search "vector_search_index": f"{UC_CATALOG}.{UC_SCHEMA}.{CHUNKS_VECTOR_INDEX.split('.')[-1]}", "llm_prompt_template": """You are an assistant that answers questions. Use the following pieces of retrieved context to answer the question. Some pieces of context may be irrelevant, in which case you should not use them to form the answer.\n\nContext: {context}""", # LLM Prompt template }

use this (highlighted in bold)

QuentinAmbard commented 1 month ago

ah I think you should just do this in this case:

"vector_search_index": CHUNKS_VECTOR_INDEX,

I'll ping the team from the cookbook

nipundavidnagarro commented 1 month ago

Hey @QuentinAmbard - can you help me with one small issue that I am facing?

So I have PDF files on ADLS and I want to access them in my Databricks workspace. with a cluster of type personal compute I can mount the ADLS, see the files, and read the content of these PDFs, but

whereas when I am using a shared cluster I can mount and see the files but when I am trying to read these PDF files I am getting "No such file or directory..."

Is there an additional setting that I have to make on a shared cluster? The same code works with personal compute but not with shared cluster.

any thoughts ?

QuentinAmbard commented 1 month ago

I think you need either to use a UC volume, or create a storage credential and an external location in UC to access your ADLS. https://learn.microsoft.com/en-us/azure/databricks/connect/unity-catalog/storage-credentials

Don't use the mount (https://learn.microsoft.com/en-us/azure/databricks/dbfs/mounts) it's legacy