Skip to main content

The official Python SDK for https://metaso.cn

Project description

metaso-sdk

ci documentation pypi version gitter

The official Python SDK for https://metaso.cn

安装

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metaso_sdk-0.1.0.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

metaso_sdk-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file metaso_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: metaso_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for metaso_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 50a9162526e0cfaacf55d92fe7629b77726e581c71f5a2c00f1911dca09cd3c2
MD5 2c38c26ac7df3432c43cce366c83a41c
BLAKE2b-256 ee350108c5da7bc4f4845a706f1327a7fe5e8bd8af630f3b498e146c8f43fb40

See more details on using hashes here.

File details

Details for the file metaso_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: metaso_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for metaso_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f362cab2055f3b99e324448c48c5b7ac3d9e4b3b38d04fd6bfca02140de66cef
MD5 80f017c68ff5a7f0692769b594b333ba
BLAKE2b-256 1db8f96d3c90c8bd119b27ed79d2ee8d9a6c77ce9e2d15e1743e27631166133e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page