Open linyx2024 opened 8 months ago
如果api的协议符合openai的,可以使用openai的配置。 api-key 可以不填
现在有个rt和ft,是啥意思啊
我是这样配置的,但是最终显示解析失败。 看了后台日志有 POST https://api.app4gpt.com/v1/embeddings "200 OK" , 但我到第三方api调用看,并没有调用该api。应该如何解决呢?
后台日志如下:
[2024-04-24 17:19:42.907934] [INFO process-9-140179548543872 bisheng.utils.http_middleware:20] - trace=4b18f0ffae34495dbbc42b7c22f29757 /api/v1/knowledge/embedding_param 201 timecost=0.02
[2024-04-24 17:19:43.513005] [INFO process-9-140179548543872 bisheng.utils.http_middleware:20] - trace=2e0403fef904481aa269f1ea97510ac8 /api/v1/knowledge/ 200 timecost=0.01
[2024-04-24 17:19:46.366316] [INFO process-9-140179548543872 bisheng.utils.http_middleware:20] - trace=c4df5107b5904c0d817316912eaa9a67 /api/v1/knowledge/file_list/3 200 timecost=0.01
[2024-04-24 17:19:49.361142] [INFO process-9-140179548543872 bisheng.utils.http_middleware:20] - trace=9c9381e5a08344e89e0944bb8fd7be2d /api/v1/knowledge/retry 200 timecost=0.01
[2024-04-24 17:19:49.385972] [INFO process-9-140176475002560 bisheng.interface.initialize.vector_store:235] - trace=9c9381e5a08344e89e0944bb8fd7be2d init_milvus collection_name=col_1713942223_e81c1a1b partition={}
[2024-04-24 17:19:49.388807] [DEBUG process-9-140176475002560 bisheng_langchain.vectorstores.milvus:266] - trace=9c9381e5a08344e89e0944bb8fd7be2d Using previous connection: eb279d1626644d49be8d9d4955be534e
[2024-04-24 17:19:49.394315] [DEBUG process-9-140176475002560 bisheng_langchain.vectorstores.milvus:484] - trace=9c9381e5a08344e89e0944bb8fd7be2d Nothing to insert, skipping.
[2024-04-24 17:19:49.396640] [INFO process-9-140176475002560 bisheng.api.services.knowledge_imp:167] - trace=9c9381e5a08344e89e0944bb8fd7be2d query_milvus pk=[]
[2024-04-24 17:19:49.420143] [DEBUG process-9-140176475002560 urllib3.connectionpool:244] - trace=9c9381e5a08344e89e0944bb8fd7be2d Starting new HTTP connection (1): elasticsearch:9200
[2024-04-24 17:19:49.429732] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://elasticsearch:9200 "GET /col_1713942223_dfffc4fc HTTP/1.1" 200 None
[2024-04-24 17:19:49.432087] [INFO process-9-140176475002560 elastic_transport._transport:349] - trace=9c9381e5a08344e89e0944bb8fd7be2d GET http://elasticsearch:9200/col_1713942223_dfffc4fc
[2024-04-24 17:19:49.438047] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://elasticsearch:9200 "POST /col_1713942223_dfffc4fc/_refresh HTTP/1.1" 200 0
[2024-04-24 17:19:49.440517] [INFO process-9-140176475002560 elastic_transport._transport:349] - trace=9c9381e5a08344e89e0944bb8fd7be2d POST http://elasticsearch:9200/col_1713942223_dfffc4fc/_refresh
[2024-04-24 17:19:49.449544] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://elasticsearch:9200 "POST /col_1713942223_dfffc4fc/_delete_by_query HTTP/1.1" 200 0
[2024-04-24 17:19:49.452020] [INFO process-9-140176475002560 elastic_transport._transport:349] - trace=9c9381e5a08344e89e0944bb8fd7be2d POST http://elasticsearch:9200/col_1713942223_dfffc4fc/_delete_by_query
[2024-04-24 17:19:49.454169] [INFO process-9-140176475002560 bisheng.api.services.knowledge_imp:192] - trace=9c9381e5a08344e89e0944bb8fd7be2d act=delete_es file_id=19 res={'took': 3, 'timed_out': False, 'total': 0, 'deleted': 0, 'batches': 0, 'version_conflicts': 0, 'noops': 0, 'retries': {'bulk':
0, 'search': 0}, 'throttled_millis': 0, 'requests_per_second': -1.0, 'throttled_until_millis': 0, 'failures': []}
[2024-04-24 17:19:49.621888] [DEBUG process-9-140176475002560 urllib3.connectionpool:244] - trace=9c9381e5a08344e89e0944bb8fd7be2d Starting new HTTP connection (1): minio:9000
[2024-04-24 17:19:49.626887] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://minio:9000 "GET /bisheng?location= HTTP/1.1" 200 0
[2024-04-24 17:19:49.631058] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://minio:9000 "HEAD /bisheng HTTP/1.1" 200 0
[2024-04-24 17:19:49.637144] [DEBUG process-9-140176475002560 urllib3.connectionpool:244] - trace=9c9381e5a08344e89e0944bb8fd7be2d Starting new HTTP connection (1): minio:9000
[2024-04-24 17:19:49.641213] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://minio:9000 "GET /bisheng?location= HTTP/1.1" 200 0
[2024-04-24 17:19:49.645881] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://minio:9000 "HEAD /bisheng/original/19.txt HTTP/1.1" 200 0
[2024-04-24 17:19:49.650542] [DEBUG process-9-140176475002560 urllib3.connectionpool:244] - trace=9c9381e5a08344e89e0944bb8fd7be2d Starting new HTTP connection (1): minio:9000
[2024-04-24 17:19:49.655850] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://minio:9000 "GET
/bisheng/original/19.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minioadmin%2F20240424%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240424T091949Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=adcabdba20ae045f4637a6c0e7fe064848daf7ca42a41ce55c2c
b4bcd74aaf10 HTTP/1.1" 200 6023
[2024-04-24 17:19:49.824138] [DEBUG process-9-140176475002560 urllib3.connectionpool:244] - trace=9c9381e5a08344e89e0944bb8fd7be2d Starting new HTTP connection (1): minio:9000
[2024-04-24 17:19:49.828458] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://minio:9000 "GET /bisheng?location= HTTP/1.1" 200 0
[2024-04-24 17:19:49.833134] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://minio:9000 "HEAD /bisheng HTTP/1.1" 200 0
[2024-04-24 17:19:49.851328] [DEBUG process-9-140176475002560 httpx._config:78] - trace=9c9381e5a08344e89e0944bb8fd7be2d load_ssl_context verify=True cert=None trust_env=True http2=False
[2024-04-24 17:19:49.854844] [DEBUG process-9-140176475002560 httpx._config:144] - trace=9c9381e5a08344e89e0944bb8fd7be2d load_verify_locations cafile='/usr/local/lib/python3.10/site-packages/certifi/cacert.pem'
[2024-04-24 17:19:49.905195] [DEBUG process-9-140176475002560 httpx._config:78] - trace=9c9381e5a08344e89e0944bb8fd7be2d load_ssl_context verify=True cert=None trust_env=True http2=False
[2024-04-24 17:19:49.908153] [DEBUG process-9-140176475002560 httpx._config:144] - trace=9c9381e5a08344e89e0944bb8fd7be2d load_verify_locations cafile='/usr/local/lib/python3.10/site-packages/certifi/cacert.pem'
[2024-04-24 17:19:49.973126] [INFO process-9-140176475002560 bisheng.interface.initialize.vector_store:235] - trace=9c9381e5a08344e89e0944bb8fd7be2d init_milvus collection_name=col_1713942223_e81c1a1b partition={}
[2024-04-24 17:19:49.995958] [INFO process-9-140179548543872 bisheng.utils.http_middleware:20] - trace=fff59d45dde54b62825b38bc6da8a187 /api/v1/knowledge/file_list/3 200 timecost=0.02
[2024-04-24 17:19:50.000556] [DEBUG process-9-140176475002560 bisheng_langchain.vectorstores.milvus:273] - trace=9c9381e5a08344e89e0944bb8fd7be2d Created new connection using: 05184d2f7e6248cd86f6b18e5575e74c
[2024-04-24 17:19:50.005720] [DEBUG process-9-140176475002560 bisheng_langchain.vectorstores.milvus:484] - trace=9c9381e5a08344e89e0944bb8fd7be2d Nothing to insert, skipping.
[2024-04-24 17:19:50.022865] [DEBUG process-9-140176475002560 urllib3.connectionpool:244] - trace=9c9381e5a08344e89e0944bb8fd7be2d Starting new HTTP connection (1): elasticsearch:9200
[2024-04-24 17:19:50.030863] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://elasticsearch:9200 "GET /col_1713942223_dfffc4fc HTTP/1.1" 200 None
[2024-04-24 17:19:50.033146] [INFO process-9-140176475002560 elastic_transport._transport:349] - trace=9c9381e5a08344e89e0944bb8fd7be2d GET http://elasticsearch:9200/col_1713942223_dfffc4fc
[2024-04-24 17:19:50.039659] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://elasticsearch:9200 "POST /col_1713942223_dfffc4fc/_refresh HTTP/1.1" 200 0
[2024-04-24 17:19:50.042160] [INFO process-9-140176475002560 elastic_transport._transport:349] - trace=9c9381e5a08344e89e0944bb8fd7be2d POST http://elasticsearch:9200/col_1713942223_dfffc4fc/_refresh
[2024-04-24 17:19:50.047261] [INFO process-9-140176475002560 bisheng.api.services.knowledge_imp:250] - trace=9c9381e5a08344e89e0944bb8fd7be2d process_file_begin knowledge_id=3 file_name=app4gpt_api文档.txt file_size=1
[2024-04-24 17:19:50.053909] [DEBUG process-9-140176475002560 bisheng.utils.minio_client:40] - trace=9c9381e5a08344e89e0944bb8fd7be2d upload_file obj=original/19.txt bucket=bisheng file_paht=/root/.cache/bisheng/bisheng/c28f1fdafe014a3848f90ff9377d2dadd9b8a46f8a818cc0a3f5df4d9f40cf7e.txt
[2024-04-24 17:19:50.061517] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://minio:9000 "PUT /bisheng/original/19.txt HTTP/1.1" 200 0
[2024-04-24 17:19:50.063960] [INFO process-9-140176475002560 bisheng.api.services.knowledge_imp:282] - trace=9c9381e5a08344e89e0944bb8fd7be2d upload_original_file path=original/19.txt res=<minio.helpers.ObjectWriteResult object at 0x7f7dbc170940>
[2024-04-24 17:19:50.080493] [DEBUG process-9-140176475002560 bisheng.utils.minio_client:40] - trace=9c9381e5a08344e89e0944bb8fd7be2d upload_file obj=19 bucket=bisheng file_paht=/root/.cache/bisheng/bisheng/c28f1fdafe014a3848f90ff9377d2dadd9b8a46f8a818cc0a3f5df4d9f40cf7e.txt
[2024-04-24 17:19:50.087340] [DEBUG process-9-140176475002560 urllib3.connectionpool:549] - trace=9c9381e5a08344e89e0944bb8fd7be2d http://minio:9000 "PUT /bisheng/19 HTTP/1.1" 200 0
[2024-04-24 17:19:50.089735] [INFO process-9-140176475002560 bisheng.api.services.knowledge_imp:291] - trace=9c9381e5a08344e89e0944bb8fd7be2d chunk_split file_name=app4gpt_api文档.txt size=2
[2024-04-24 17:19:50.091854] [ERROR process-9-140176475002560 bisheng.api.services.knowledge_imp:292] - trace=9c9381e5a08344e89e0944bb8fd7be2d 1 =========================================================
[2024-04-24 17:19:50.094086] [ERROR process-9-140176475002560 bisheng.api.services.knowledge_imp:307] - trace=9c9381e5a08344e89e0944bb8fd7be2d ==========================================================
[2024-04-24 17:19:50.096236] [ERROR process-9-140176475002560 bisheng.api.services.knowledge_imp:312] - trace=9c9381e5a08344e89e0944bb8fd7be2d before vectore_client.add_texts ==========================================================
[2024-04-24 17:19:50.123094] [DEBUG process-9-140176475002560 openai._base_client:442] - trace=9c9381e5a08344e89e0944bb8fd7be2d Request options: {'method': 'post', 'url': '/embeddings', 'files': None, 'post_parser': <function Embeddings.create.
[2024-04-24 17:19:50.198049] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d connect_tcp.started host='api.app4gpt.com' port=443 local_address=None timeout=None socket_options=None
[2024-04-24 17:19:50.410770] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7f7dbc6218d0>
[2024-04-24 17:19:50.413398] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d start_tls.started ssl_context=<ssl.SSLContext object at 0x7f7dbc44d3c0> server_hostname='api.app4gpt.com' timeout=None
[2024-04-24 17:19:50.616649] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7f7dbc61a9b0>
[2024-04-24 17:19:50.619364] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d send_request_headers.started request=
[2024-04-24 17:19:50.623978] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d send_request_body.started request=
[2024-04-24 17:19:50.629321] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d receive_response_headers.started request=
b'{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=w4IW2LzavGRPr6tdozkEzjZ6ZA6bfGy8BXVjDSdZz8K9MVVAO%2BsTM%2BPmnegwC5GQsSoF8B5GxKPm1penAHtQXTYd8w6%2FT2zviFzwxco%2BWN5tYuEWNLuCPmmqHw9FoP3piMI%3D"}],"group":"cf-nel","max_age":604800}'), (b'NEL',
b'{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'), (b'Server', b'cloudflare'), (b'CF-RAY', b'87950395f8177783-LHR'), (b'Content-Encoding', b'gzip'), (b'alt-svc', b'h3=":443"; ma=86400')])
[2024-04-24 17:19:57.250668] [INFO process-9-140176475002560 httpx._client:1013] - trace=9c9381e5a08344e89e0944bb8fd7be2d HTTP Request: POST https://api.app4gpt.com/v1/embeddings "HTTP/1.1 200 OK"
[2024-04-24 17:19:57.253157] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d receive_response_body.started request=
[2024-04-24 17:19:57.258250] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d response_closed.started
[2024-04-24 17:19:57.260343] [DEBUG process-9-140176475002560 httpcore._trace:45] - trace=9c9381e5a08344e89e0944bb8fd7be2d response_closed.complete
[2024-04-24 17:19:57.262372] [DEBUG process-9-140176475002560 openai._base_client:962] - trace=9c9381e5a08344e89e0944bb8fd7be2d HTTP Request: POST https://api.app4gpt.com/v1/embeddings "200 OK"
[2024-04-24 17:19:57.264703] [ERROR process-9-140176475002560 bisheng.api.services.knowledge_imp:339] - trace=9c9381e5a08344e89e0944bb8fd7be2d add_vectordb 'NoneType' object is not iterable
关注一下
有解决办法了吗
我是这样配的,用的智谱的embedding-2 的 api,貌似可以:
embeddings: # 配置知识库的embedding服务,以下示例填写了两类embedding服务的配置方法,第一个是openai的embedding模型服务的配置方法,第二个是本地部署的embedding模型服务的配置方法,如果有多个可以添加多个
embedding-2: # 知识库下拉框中显示的embedding模型的名称,可自定义
component: openai
openai_api_base: "https://open.bigmodel.cn/api/paas/v4"
openai_api_key: "xxx"
model: "embedding-2"
我是这样配的,用的智谱的embedding-2 的 api,貌似可以:
embeddings: # 配置知识库的embedding服务,以下示例填写了两类embedding服务的配置方法,第一个是openai的embedding模型服务的配置方法,第二个是本地部署的embedding模型服务的配置方法,如果有多个可以添加多个 embedding-2: # 知识库下拉框中显示的embedding模型的名称,可自定义 component: openai openai_api_base: "https://open.bigmodel.cn/api/paas/v4" openai_api_key: "xxx" model: "embedding-2"
我去试试
AzureOpenAIEmbeddings 支持吗?需要怎么配置?
我是这样配的,用的智谱的embedding-2 的 api,貌似可以:
embeddings: # 配置知识库的embedding服务,以下示例填写了两类embedding服务的配置方法,第一个是openai的embedding模型服务的配置方法,第二个是本地部署的embedding模型服务的配置方法,如果有多个可以添加多个 embedding-2: # 知识库下拉框中显示的embedding模型的名称,可自定义 component: openai openai_api_base: "https://open.bigmodel.cn/api/paas/v4" openai_api_key: "xxx" model: "embedding-2"
我按照这种情况 是可以接入智谱的 但是自己部署的和oneapi转接的都不行
如果在国内本地部署不安装rt服务,且没有代理访问openai的条件下,知识库是否就无法正常解析问题,如果想通过api使用其他模型的embedding功能的话,应该如何配置系统配置中的文件。