|
@ -21,7 +21,7 @@ from towhee import pipe, ops, DataCollection |
|
|
|
|
|
|
|
|
p = pipe.input('collection_name', 'text') \ |
|
|
p = pipe.input('collection_name', 'text') \ |
|
|
.map('text', 'vec', ops.sentence_embedding.transformers(model_name='all-MiniLM-L12-v2')) \ |
|
|
.map('text', 'vec', ops.sentence_embedding.transformers(model_name='all-MiniLM-L12-v2')) \ |
|
|
.flat_map(('collection_name', 'vec'), 'rows', ops.ann_search.milvus_client(host='127.0.0.1', port='19530', **{'output_fields': ['text']})) \ |
|
|
|
|
|
|
|
|
.map(('collection_name', 'vec'), 'rows', ops.ann_search.osschat_milvus(host='127.0.0.1', port='19530', **{'output_fields': ['text']})) \ |
|
|
.map('rows', ('id', 'score', 'text'), lambda x: (x[0], x[1], x[2])) \ |
|
|
.map('rows', ('id', 'score', 'text'), lambda x: (x[0], x[1], x[2])) \ |
|
|
.output('id', 'score', 'text') |
|
|
.output('id', 'score', 'text') |
|
|
|
|
|
|
|
@ -39,7 +39,7 @@ from towhee import pipe, ops, DataCollection |
|
|
|
|
|
|
|
|
p = pipe.input('collection_name', 'text') \ |
|
|
p = pipe.input('collection_name', 'text') \ |
|
|
.map('text', 'vec', ops.sentence_embedding.transformers(model_name='all-MiniLM-L12-v2')) \ |
|
|
.map('text', 'vec', ops.sentence_embedding.transformers(model_name='all-MiniLM-L12-v2')) \ |
|
|
.map(('collection_name', 'vec'), 'rows', ops.ann_search.milvus_client(host='127.0.0.1', port='19530', **{'output_fields': ['text']})) \ |
|
|
|
|
|
|
|
|
.map(('collection_name', 'vec'), 'rows', ops.ann_search.osschat_milvus(host='127.0.0.1', port='19530', **{'output_fields': ['text']})) \ |
|
|
.output('rows') |
|
|
.output('rows') |
|
|
|
|
|
|
|
|
DataCollection(p('test_collection', 'cat')).show() |
|
|
DataCollection(p('test_collection', 'cat')).show() |
|
|