Repository: langchain
Issue: Lancedb hybrid search use reranker will throw ValueError 
Labels: Ɑ: vector store

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangChain rather than my code.
- [X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

### Example Code

```python
vector_store = LanceDB(embedding=embedding_model, uri="./lancedb", reranker=reranker)
...
retrieved_docs = vector_store.similarity_search(query=state["question"], query_type="hybrid")
```

### Error Message and Stack Trace (if applicable)


![image](https://github.com/user-attachments/assets/37c0da88-bfae-4568-aaf6-45e1064b9d77)

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\pregel\__init__.py:1927, in Pregel.invoke(self, input, config, stream_mode, output_keys, interrupt_File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\pregel\__init__.py:1927, in Pregel.invoke(self, input, config, stream_mode, output_keys, interrupt_before, interrupt_after, debug, **kwargs)
   [1925](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1925) else:
   [1926](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1926)     chunks = []
-> [1927](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1927) for chunk in self.stream(
   [1928](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1928)     input,
   [1929](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1929)     config,
   [1930](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1930)     stream_mode=stream_mode,
   [1931](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1931)     output_keys=output_keys,
   [1932](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1932)     interrupt_before=interrupt_before,
   [1933](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1933)     interrupt_after=interrupt_after,
   [1934](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1934)     debug=debug,
   [1935](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1935)     **kwargs,
   [1936](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1936) ):
   [1937](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1937)     if stream_mode == "values":
   [1938](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1938)         latest = chunk

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\pregel\__init__.py:1647, in Pregel.stream(self, input, config, stream_mode, output_keys, interrupt_before, interrupt_after, debug, subgraphs)
   [1641](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1641)     # Similarly to Bulk Synchronous Parallel / Pregel model
   [1642](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1642)     # computation proceeds in steps, while there are channel updates
   [1643](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1643)     # channel updates from step N are only visible in step N+1
   [1644](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1644)     # channels are guaranteed to be immutable for the duration of the step,
   [1645](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1645)     # with channel updates applied only at the transition between steps
   [1646](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1646)     while loop.tick(input_keys=self.input_channels):
-> [1647](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1647)         for _ in runner.tick(
   [1648](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1648)             loop.tasks.values(),
   [1649](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1649)             timeout=self.step_timeout,
   [1650](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1650)             retry_policy=self.retry_policy,
   [1651](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1651)             get_waiter=get_waiter,
   [1652](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1652)         ):
   [1653](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1653)             # emit output
   [1654](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1654)             yield from output()
   [1655](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1655) # emit output

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\pregel\runner.py:104, in PregelRunner.tick(self, tasks, reraise, timeout, retry_policy, get_waiter)
    [102](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:102) t = tasks[0]
    [103](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:103) try:
--> [104](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:104)     run_with_retry(t, retry_policy, writer=writer)
    [105](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:105)     self.commit(t, None)
    [106](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:106) except Exception as exc:

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\pregel\retry.py:40, in run_with_retry(task, retry_policy, writer)
     [38](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:38) task.writes.clear()
     [39](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:39) # run the task
---> [40](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:40) task.proc.invoke(task.input, config)
     [41](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:41) # if successful, end
     [42](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:42) break

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\utils\runnable.py:410, in RunnableSeq.invoke(self, input, config, **kwargs)
    [408](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:408) context.run(_set_config_context, config)
    [409](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:409) if i == 0:
--> [410](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:410)     input = context.run(step.invoke, input, config, **kwargs)
    [411](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:411) else:
    [412](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:412)     input = context.run(step.invoke, input, config)

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\utils\runnable.py:184, in RunnableCallable.invoke(self, input, config, **kwargs)
    [182](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:182) else:
    [183](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:183)     context.run(_set_config_context, config)
--> [184](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:184)     ret = context.run(self.func, input, **kwargs)
    [185](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:185) if isinstance(ret, Runnable) and self.recurse:
    [186](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:186)     return ret.invoke(input, config)

Cell In[16], [line 17](vscode-notebook-cell:?execution_count=16&line=17)
     [12](vscode-notebook-cell:?execution_count=16&line=12) def retrieve(state: State):
     [13](vscode-notebook-cell:?execution_count=16&line=13)     # retriever = vector_store.as_retriever(
     [14](vscode-notebook-cell:?execution_count=16&line=14)     #     search_type="similarity_score_threshold",
     [15](vscode-notebook-cell:?execution_count=16&line=15)     #     search_kwargs={"score_threshold": 0.5},  # A greater value returns items with more relevance
     [16](vscode-notebook-cell:?execution_count=16&line=16)     # )
---> [17](vscode-notebook-cell:?execution_count=16&line=17)     retrieved_docs = vector_store.similarity_search(query=state["question"], query_type="hybrid")
     [18](vscode-notebook-cell:?execution_count=16&line=18)     # retrieved_docs = retriever.invoke(state["question"])
     [19](vscode-notebook-cell:?execution_count=16&line=19)     return {"context": retrieved_docs, "source": [doc.metadata["source"] for doc in retrieved_docs]}

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langchain_community\vectorstores\lancedb.py:525, in LanceDB.similarity_search(self, query, k, name, filter, fts, **kwargs)
    [501](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:501) def similarity_search(
    [502](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:502)     self,
    [503](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:503)     query: str,
   (...)
    [508](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:508)     **kwargs: Any,
    [509](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:509) ) -> List[Document]:
    [510](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:510)     """Return documents most similar to the query
    [511](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:511) 
    [512](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:512)     Args:
   (...)
    [523](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:523)         List of documents most similar to the query.
    [524](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:524)     """
--> [525](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:525)     res = self.similarity_search_with_score(
    [526](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:526)         query=query, k=k, name=name, filter=filter, fts=fts, score=False, **kwargs
    [527](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:527)     )
    [528](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:528)     return res

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langchain_community\vectorstores\lancedb.py:490, in LanceDB.similarity_search_with_score(self, query, k, filter, **kwargs)
    [487](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:487)     else:
    [488](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:488)         _query = query  # type: ignore
--> [490](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:490)     res = self._query(_query, k, filter=filter, **kwargs)
    [491](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:491)     return self.results_to_docs(res, score=score)
    [492](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:492) else:

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langchain_community\vectorstores\lancedb.py:385, in LanceDB._query(self, query, k, filter, name, **kwargs)
    [377](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:377)     lance_query = (
    [378](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:378)         tbl.search(query=query, vector_column_name=self._vector_key)
    [379](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:379)         .limit(k)
    [380](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:380)         .metric(metrics)
    [381](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:381)         .where(filter, prefilter=prefilter)
    [382](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:382)     )
    [383](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:383) else:
    [384](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:384)     lance_query = (
--> [385](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:385)         tbl.search(query=query, vector_column_name=self._vector_key)
    [386](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:386)         .limit(k)
    [387](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:387)         .where(filter, prefilter=prefilter)
    [388](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:388)     )
    [389](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:389) if query_type == "hybrid" and self._reranker is not None:
    [390](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:390)     lance_query.rerank(reranker=self._reranker)

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\lancedb\table.py:1570, in LanceTable.search(self, query, vector_column_name, query_type, ordering_field_name, fts_columns)
   [1567](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1567)     except Exception as e:
   [1568](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1568)         raise e
-> [1570](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1570) return LanceQueryBuilder.create(
   [1571](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1571)     self,
   [1572](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1572)     query,
   [1573](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1573)     query_type,
   [1574](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1574)     vector_column_name=vector_column_name,
   [1575](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1575)     ordering_field_name=ordering_field_name,
   [1576](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1576)     fts_columns=fts_columns,
   [1577](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1577) )

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\lancedb\query.py:192, in LanceQueryBuilder.create(cls, table, query, query_type, vector_column_name, ordering_field_name, fts_columns)
    [184](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:184)     return LanceFtsQueryBuilder(
    [185](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:185)         table,
    [186](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:186)         query,
    [187](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:187)         ordering_field_name=ordering_field_name,
    [188](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:188)         fts_columns=fts_columns,
    [189](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:189)     )
    [191](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:191) if isinstance(query, list):
--> [192](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:192)     query = np.array(query, dtype=np.float32)
    [193](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:193) elif isinstance(query, np.ndarray):
    [194](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:194)     query = query.astype(np.float32)

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.before, interrupt_after, debug, **kwargs)
   [1925](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1925) else:
   [1926](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1926)     chunks = []
-> [1927](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1927) for chunk in self.stream(
   [1928](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1928)     input,
   [1929](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1929)     config,
   [1930](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1930)     stream_mode=stream_mode,
   [1931](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1931)     output_keys=output_keys,
   [1932](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1932)     interrupt_before=interrupt_before,
   [1933](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1933)     interrupt_after=interrupt_after,
   [1934](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1934)     debug=debug,
   [1935](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1935)     **kwargs,
   [1936](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1936) ):
   [1937](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1937)     if stream_mode == "values":
   [1938](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1938)         latest = chunk

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\pregel\__init__.py:1647, in Pregel.stream(self, input, config, stream_mode, output_keys, interrupt_before, interrupt_after, debug, subgraphs)
   [1641](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1641)     # Similarly to Bulk Synchronous Parallel / Pregel model
   [1642](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1642)     # computation proceeds in steps, while there are channel updates
   [1643](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1643)     # channel updates from step N are only visible in step N+1
   [1644](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1644)     # channels are guaranteed to be immutable for the duration of the step,
   [1645](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1645)     # with channel updates applied only at the transition between steps
   [1646](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1646)     while loop.tick(input_keys=self.input_channels):
-> [1647](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1647)         for _ in runner.tick(
   [1648](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1648)             loop.tasks.values(),
   [1649](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1649)             timeout=self.step_timeout,
   [1650](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1650)             retry_policy=self.retry_policy,
   [1651](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1651)             get_waiter=get_waiter,
   [1652](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1652)         ):
   [1653](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1653)             # emit output
   [1654](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1654)             yield from output()
   [1655](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/__init__.py:1655) # emit output

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\pregel\runner.py:104, in PregelRunner.tick(self, tasks, reraise, timeout, retry_policy, get_waiter)
    [102](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:102) t = tasks[0]
    [103](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:103) try:
--> [104](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:104)     run_with_retry(t, retry_policy, writer=writer)
    [105](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:105)     self.commit(t, None)
    [106](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/runner.py:106) except Exception as exc:

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\pregel\retry.py:40, in run_with_retry(task, retry_policy, writer)
     [38](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:38) task.writes.clear()
     [39](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:39) # run the task
---> [40](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:40) task.proc.invoke(task.input, config)
     [41](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:41) # if successful, end
     [42](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/pregel/retry.py:42) break

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\utils\runnable.py:410, in RunnableSeq.invoke(self, input, config, **kwargs)
    [408](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:408) context.run(_set_config_context, config)
    [409](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:409) if i == 0:
--> [410](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:410)     input = context.run(step.invoke, input, config, **kwargs)
    [411](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:411) else:
    [412](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:412)     input = context.run(step.invoke, input, config)

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langgraph\utils\runnable.py:184, in RunnableCallable.invoke(self, input, config, **kwargs)
    [182](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:182) else:
    [183](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:183)     context.run(_set_config_context, config)
--> [184](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:184)     ret = context.run(self.func, input, **kwargs)
    [185](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:185) if isinstance(ret, Runnable) and self.recurse:
    [186](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langgraph/utils/runnable.py:186)     return ret.invoke(input, config)

Cell In[16], [line 17](vscode-notebook-cell:?execution_count=16&line=17)
     [12](vscode-notebook-cell:?execution_count=16&line=12) def retrieve(state: State):
     [13](vscode-notebook-cell:?execution_count=16&line=13)     # retriever = vector_store.as_retriever(
     [14](vscode-notebook-cell:?execution_count=16&line=14)     #     search_type="similarity_score_threshold",
     [15](vscode-notebook-cell:?execution_count=16&line=15)     #     search_kwargs={"score_threshold": 0.5},  # A greater value returns items with more relevance
     [16](vscode-notebook-cell:?execution_count=16&line=16)     # )
---> [17](vscode-notebook-cell:?execution_count=16&line=17)     retrieved_docs = vector_store.similarity_search(query=state["question"], query_type="hybrid")
     [18](vscode-notebook-cell:?execution_count=16&line=18)     # retrieved_docs = retriever.invoke(state["question"])
     [19](vscode-notebook-cell:?execution_count=16&line=19)     return {"context": retrieved_docs, "source": [doc.metadata["source"] for doc in retrieved_docs]}

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langchain_community\vectorstores\lancedb.py:525, in LanceDB.similarity_search(self, query, k, name, filter, fts, **kwargs)
    [501](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:501) def similarity_search(
    [502](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:502)     self,
    [503](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:503)     query: str,
   (...)
    [508](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:508)     **kwargs: Any,
    [509](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:509) ) -> List[Document]:
    [510](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:510)     """Return documents most similar to the query
    [511](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:511) 
    [512](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:512)     Args:
   (...)
    [523](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:523)         List of documents most similar to the query.
    [524](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:524)     """
--> [525](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:525)     res = self.similarity_search_with_score(
    [526](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:526)         query=query, k=k, name=name, filter=filter, fts=fts, score=False, **kwargs
    [527](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:527)     )
    [528](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:528)     return res

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langchain_community\vectorstores\lancedb.py:490, in LanceDB.similarity_search_with_score(self, query, k, filter, **kwargs)
    [487](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:487)     else:
    [488](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:488)         _query = query  # type: ignore
--> [490](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:490)     res = self._query(_query, k, filter=filter, **kwargs)
    [491](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:491)     return self.results_to_docs(res, score=score)
    [492](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:492) else:

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\langchain_community\vectorstores\lancedb.py:385, in LanceDB._query(self, query, k, filter, name, **kwargs)
    [377](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:377)     lance_query = (
    [378](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:378)         tbl.search(query=query, vector_column_name=self._vector_key)
    [379](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:379)         .limit(k)
    [380](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:380)         .metric(metrics)
    [381](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:381)         .where(filter, prefilter=prefilter)
    [382](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:382)     )
    [383](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:383) else:
    [384](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:384)     lance_query = (
--> [385](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:385)         tbl.search(query=query, vector_column_name=self._vector_key)
    [386](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:386)         .limit(k)
    [387](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:387)         .where(filter, prefilter=prefilter)
    [388](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:388)     )
    [389](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:389) if query_type == "hybrid" and self._reranker is not None:
    [390](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/langchain_community/vectorstores/lancedb.py:390)     lance_query.rerank(reranker=self._reranker)

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\lancedb\table.py:1570, in LanceTable.search(self, query, vector_column_name, query_type, ordering_field_name, fts_columns)
   [1567](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1567)     except Exception as e:
   [1568](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1568)         raise e
-> [1570](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1570) return LanceQueryBuilder.create(
   [1571](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1571)     self,
   [1572](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1572)     query,
   [1573](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1573)     query_type,
   [1574](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1574)     vector_column_name=vector_column_name,
   [1575](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1575)     ordering_field_name=ordering_field_name,
   [1576](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1576)     fts_columns=fts_columns,
   [1577](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/table.py:1577) )

File d:\ProgramData\miniforge3\envs\t2\Lib\site-packages\lancedb\query.py:192, in LanceQueryBuilder.create(cls, table, query, query_type, vector_column_name, ordering_field_name, fts_columns)
    [184](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:184)     return LanceFtsQueryBuilder(
    [185](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:185)         table,
    [186](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:186)         query,
    [187](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:187)         ordering_field_name=ordering_field_name,
    [188](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:188)         fts_columns=fts_columns,
    [189](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:189)     )
    [191](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:191) if isinstance(query, list):
--> [192](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:192)     query = np.array(query, dtype=np.float32)
    [193](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:193) elif isinstance(query, np.ndarray):
    [194](file:///D:/ProgramData/miniforge3/envs/t2/Lib/site-packages/lancedb/query.py:194)     query = query.astype(np.float32)

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

### Description

1. The first time, the above code will be thrown a `TypeError: langchain_community.vectorstores.lancedb.LanceDB._query() got multiple values for keyword argument 'name'`, I modify `langchian_commutity.vectorstores.lancedb.py:490`  `res = self._query(_query, k, name=name, filter=filter, **kwargs)`, kwargs already include name, so I just remove `name=name`
2.  then, It throws `unsported query type 'tuple'`, so I modify `langchian_commutity.vectorstores.lancedb.py:486`  `_query = (embedding, query)` to `_query = [embedding, query]`
3. now, It throws `ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.`

### System Info

System Information
------------------
> OS:  Windows
> OS Version:  10.0.26100
> Python Version:  3.12.7 | packaged by conda-forge | (main, Oct  4 2024, 15:47:54) [MSC v.1941 64 bit (AMD64)]

Package Information
-------------------
> langchain_core: 0.3.21
> langchain: 0.3.8
> langchain_community: 0.3.8
> langsmith: 0.1.146
> langchain_ollama: 0.2.0
> langchain_openai: 0.2.10
> langchain_text_splitters: 0.3.2
> langgraph_sdk: 0.1.40

Optional packages not installed
-------------------------------
> langserve

Other Dependencies
------------------
> aiohttp: 3.11.7
> async-timeout: 4.0.3
> dataclasses-json: 0.6.7
> httpx: 0.27.2
> httpx-sse: 0.4.0
> jsonpatch: 1.33
> numpy: 1.26.4
> ollama: 0.4.1
> openai: 1.55.1
> orjson: 3.10.12
> packaging: 24.2
> pydantic: 2.10.1
> pydantic-settings: 2.6.1
> PyYAML: 6.0.2
> requests: 2.32.3
> requests-toolbelt: 1.0.0
> SQLAlchemy: 2.0.35
> tenacity: 9.0.0
> tiktoken: 0.7.0
> typing-extensions: 4.12.2