netease-youdao / BCEmbedding

Netease Youdao's open-source embedding and reranker models for RAG products.
Apache License 2.0
1.35k stars 90 forks source link

Use in LlamaIndex the BCEReranker import error #24

Closed Hiiboom closed 6 months ago

Hiiboom commented 6 months ago

I install the llama-index-0.10.14, according the Demo :from BCEmbedding.tools.llama_index import BCERerank when i import it report: `--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[24], line 14 12 from llama_index.vector_stores.postgres import PGVectorStore 13 import os ---> 14 from BCEmbedding.tools.llama_index import BCERerank 15 from flask import Flask, request, jsonify

File ~/anaconda3/lib/python3.11/site-packages/BCEmbedding/tools/llama_index/init.py:8 1 ''' 2 @Description: 3 @Author: shenlei (...) 6 @LastEditors: shenlei 7 ''' ----> 8 from .bce_rerank import BCERerank

File ~/anaconda3/lib/python3.11/site-packages/BCEmbedding/tools/llama_index/bce_rerank.py:10 1 ''' 2 @Description: 3 @Author: shenlei (...) 6 @LastEditors: shenlei 7 ''' 8 from typing import Any, List, Optional ---> 10 from llama_index.bridge.pydantic import Field, PrivateAttr 11 from llama_index.callbacks import CBEventType, EventPayload 12 from llama_index.postprocessor.types import BaseNodePostprocessor

ModuleNotFoundError: No module named 'llama_index.bridge'`

and i tried to uninstall llama-index reinstall it,but it not works,if you see this issus please give me some suggest.

shenlei1020 commented 6 months ago

Thanks for your report! We provide a demo with llama-index==0.9.22 in README. You can try the demo in the specific version in your product, or you can PR if your code needs lama-index with a higher version like 0.10.14

Hiiboom commented 6 months ago

@shenlei1020 thanks for your help! I'll try it.

atlas-comstock commented 5 months ago

or you can PR if your code needs lama-index with a higher version like 0.10.14

@shenlei1020 hi, i need it, and it just requires update all your imports to

from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.callbacks import CBEventType, EventPayload
from llama_index.legacy.postprocessor.types import BaseNodePostprocessor
from llama_index.legacy.schema import MetadataMode, NodeWithScore, QueryBundle
from llama_index.legacy.utils import infer_torch_device