Skip to main content

metaso-sdk

ci documentation pypi version

秘塔AI搜索 Python SDK。在使用这个 SDK 之前,请先通过API文档专题了解 HTTP 接口的更多细节。

安装

pip install metaso-sdk

配置 METASO_API_KEY

metaso-sdk 从环境变量 METASO_API_KEY 读取用于认证的 API 密钥,可以在 shell 里进行设置:

export METASO_API_KEY="mk-EE2..."

或者在 Python 代码里进行设置:

import os
os.environ["METASO_API_KEY"] = "mk-EE2..."

搜索

搜索问题

from metaso_sdk import search, Query
search(Query(question="abc"))

追问

search(Query(question="广播公司", sessionId="8550018047390023680"))

流式返回

for chunk in search(Query(question="abc"), stream=True):
    print(chunk)

...
{'type': 'heartbeat'}
{'text': '因此,“abc”可以指代字母表的前三个字母、美籍华裔、美国广播公司、一种音乐记谱法以及一种编程语言。具体含义需要根据上下文来确定。', 'type': 'append-text'}

专题

递归上传文件夹

from metaso_sdk import create_topic, upload_directory, Topic

topic = create_topic(Topic(name="functional programing"))
files = upload_directory(topic, "dir")

搜索特定专题

from metaso_sdk import search, Query

query = Query(question="functional")
search(query, topic=topic)

Metadata

Release files for metaso-sdk 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metaso-sdk 0.1.6
File Size Uploaded
metaso_sdk-0.1.6.tar.gz 2.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for metaso-sdk 0.1.6
File Interpreter ABI Platform
metaso_sdk-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 2.6 MB

Release files / metaso_sdk-0.1.6.tar.gz

Download URL metaso_sdk-0.1.6.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
7e2af938935eecfa6ec14ab6f9f0791b1a20f57d395685243e8960bc03db757e
BLAKE2b-256 checksum
How to use checksums
6cf66563dc6a3fcb117199d0cba23d8904c85dc22bd85be35aac15b5c48be070
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / metaso_sdk-0.1.6-py3-none-any.whl

Download URL metaso_sdk-0.1.6-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44bd4811b67c8d89ec04ffb457cdb4ecdd66ce79dbb05314512a5374f2c59f1e
BLAKE2b-256 checksum
How to use checksums
9f7fd07a4c611fcb02825200178ec6cb6cbe4cfae6c92708045a7b6c2f26adb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page