![Github Banner](assets/github_banner.png)
[![Documentation Status](https://readthedocs.org/projects/relevanceai/badge/?version=latest)](https://relevanceai.readthedocs.io/en/latest/?badge=latest)
[![License](https://img.shields.io/pypi/l/relevanceai)](https://img.shields.io/pypi/l/relevanceai)
For guides, tutorials on how to use this package, visit https://docs.relevance.ai/docs.
## ð¥ Features
Features of the library include:
- Quick vector search with free dashboard to preview results
- Vector clustering with support with built-in easy customisation
- Multi-vector search with filtering, facets, weighting
- Hybrid search (weighting exact text matching and vector search together)
... and more!
## ð§ Documentation
There are two main ways of documentations to take a look at:
| API type | Link |
| ------------- | ----------- |
| Guides | [Documentation](https://docs.relevance.ai/) |
| Python Reference | [Documentation](https://relevanceai.readthedocs.io/) |
## ð ï¸ Installation
```{bash}
pip install -U relevanceai
```
Or you can install it via conda to:
```{bash}
conda install pip
pip install -c relevanceai
```
You can also install on conda (only available on Linux environments at the moment): `conda install -c relevance relevanceai`.
## â© Quickstart
### Login into your project space
```{python}
from relevanceai import Client
client = relevanceai.Client(<project_name>, <api_key>)
```
This is a data example in the right format to be uploaded to relevanceai. Every document you upload should:
- Be a list of dictionaries
- Every dictionary has a field called _id
- Vector fields end in _vector_
```{python}
docs = [
{"_id": "1", "example_vector_": [0.1, 0.1, 0.1], "data": "Documentation"},
{"_id": "2", "example_vector_": [0.2, 0.2, 0.2], "data": "Best document!"},
{"_id": "3", "example_vector_": [0.3, 0.3, 0.3], "data": "document example"},
{"_id": "4", "example_vector_": [0.4, 0.4, 0.4], "data": "this is another doc"},
{"_id": "5", "example_vector_": [0.5, 0.5, 0.5], "data": "this is a doc"},
]
```
### Upload data into a new dataset
The documents will be uploaded into a new dataset that you can name in whichever way you want. If the dataset name does not exist yet, it will be created automatically. If the dataset already exist, the uploaded _id will be replacing the old data.
```{python}
client.insert_documents(dataset_id="quickstart", docs=docs)
```
### Perform a vector search
```{python}
client.services.search.vector(
dataset_id="quickstart",
multivector_query=[
{"vector": [0.2, 0.2, 0.2], "fields": ["example_vector_"]},
],
page_size=3,
query="sample search" # Stored on the dashboard but not required
```
## ð§ Development
### Getting Started
To get started with development, ensure you have pytest and mypy installed. These will help ensure typechecking and testing.
```{bash}
python -m pip install pytest mypy
```
Then run testing using:
Make sure to set your test credentials!
```{bash}
export TEST_PROJECT = xxx
export TEST_API_KEY = xxx
python -m pytest
mypy relevanceai
```
## 𧰠Config
The config contains the adjustable global settings for the SDK. For a description of all the settings, see here.
To view setting options, run the following:
```{python}
client.config.options
```
The syntax for selecting an option is section.key. For example, to disable logging, run the following to modify logging.enable_logging:
```{python}
client.config.set_option('logging.enable_logging', False)
```
To restore all options to their default, run the following:
### Changing the base URL
You can change the base URL as such:
```{python}
client.base_url = "https://.../latest"
```
You can also update the ingest base URL:
```{python}
client.ingest_base_url = "https://.../latest
```
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
资源分类:Python库 所属语言:Python 资源全名:RelevanceAI-0.29.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
Python库 | RelevanceAI-0.29.1.tar.gz (105个子文件)
setup.cfg 38B
config.ini 642B
LICENSE 11KB
README.md 4KB
PKG-INFO 6KB
PKG-INFO 6KB
search.py 48KB
dataset.py 38KB
batch_insert.py 34KB
cluster.py 24KB
clusterer.py 22KB
datasets.py 20KB
cluster_evaluate.py 20KB
projector.py 19KB
datasets.py 17KB
centroids.py 15KB
documents.py 14KB
plot_text_theme_model.py 13KB
recommend.py 13KB
tasks.py 13KB
conftest.py 9KB
transport.py 9KB
kmeans_clusterer.py 7KB
http_client.py 7KB
tagger.py 7KB
cluster_base.py 7KB
callbacks.py 7KB
centroids.py 7KB
batch_retrieve.py 7KB
centroids.py 6KB
mongo_to_relevance_ai.py 6KB
setup.py 5KB
aggregate.py 5KB
dim_reduction.py 4KB
groupby.py 4KB
config.py 4KB
cluster.py 4KB
admin.py 4KB
prediction.py 3KB
test_batch_insert.py 3KB
json_encoder.py 3KB
test_Dataset.py 3KB
test_clustering.py 3KB
monitor.py 3KB
test_projection.py 2KB
utils.py 2KB
concurrency.py 2KB
progress_bar.py 2KB
services.py 2KB
wordclouds.py 2KB
test_datasets.py 2KB
encoders.py 2KB
constants.py 2KB
test_cluster.py 2KB
nearest_neighbours.py 2KB
app.py 2KB
base_text_processing.py 2KB
logger.py 1KB
test_config.py 1KB
local_logger.py 1KB
__init__.py 1024B
chunk.py 986B
test_datasets_api.py 949B
control_panel.py 923B
test_quickstart.py 909B
test_search.py 888B
test_smoke.py 811B
client.py 803B
errors.py 761B
buttons.py 758B
display_panel.py 754B
client.py 744B
header.py 709B
graph.py 631B
client.py 621B
utils.py 612B
print_formats.py 594B
base.py 510B
cluster.py 404B
dashboard_mappings.py 293B
__init__.py 198B
sections.py 117B
__init__.py 104B
__init__.py 40B
__init__.py 36B
__init__.py 33B
__init__.py 32B
__init__.py 20B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
requests_config.py 0B
__init__.py 0B
__init__.py 0B
共 105 条
- 1
- 2
资源评论
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功