Skip to main content

This is a module for MobAI.API.

Project description

ShanHeUniversity

使用方法

使用流程总览

1.申请密钥(apply)

2.新建记录(CreateNewAPI)

3.循环聊天(ChatAPI)


申请密钥

准备工作

1.Python3.*

2.pip install shanheuniversity

示例代码

from ShanHeuniversity import api

api.apply(email='demo@shu.edu')

参数总览

参数名 参数类型 是否必填 默认值 示例
email String sb@xxx.com

新建记录

准备工作

1.Python3.*

2.pip install shanheuniversity

示例代码

from ShanHeuniversity import api
import sys
import os

function = lambda data: sys.stdout.write(str(data))

api._api_key = os.getenv('MOBAI_API_KEY')
function(
    api.CreateNewAPI(model='MobAI')
)

参数总览

参数名 参数类型 是否必填 默认值 示例
api_key String sk-demo
model String 天马行空

循环聊天

准备工作

1.Python3.*

2.pip install shanheuniversity

示例代码

import sys
import os
from ShanHeuniversity import api

function = lambda data: sys.stdout.write(
    'MobAI:' + data.data.reply + '

'
    if data.state == 'success'
    else 'ERROR:' + data.data.error + '

'
)
ask = input

api._api_key = os.getenv('MOBAI_API_KEY')
while True:
    function(
        api.ChatAPI(
            _id='id',
            password='password',
            question=ask('User:')
        )
    )

参数总览

参数名 参数类型 是否必填 默认值 示例
api_key String sk-demo
_id String 0000-0000-0000-0000
password String password-1234
question String Hello!

可参考示例

以下代码可直接运行,但不建议,因为这只是一个最基本的示例。

import sys
from ShanHeuniversity import api

ask = input
function = lambda data: sys.stdout.write(
    'MobAI:' + str(data.get('data').get('reply')) + '

'
    if data.get('state') == 'success'
    else 'ERROR:' + data.get('data').get('error') + '

'
)

api.apply(email=ask('Mail:'))

api._api_key = ask('Key:')

ai = api.CreateNewAPI(model=ask('Model:'))

while True:
    function(
        api.ChatAPI(
            _id=ai.data.id,
            password=ai.data.password,
            question=ask('User:')
        )
    )

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

ShanHeuniversity-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

ShanHeuniversity-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ShanHeuniversity-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for ShanHeuniversity-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b7a47ec81b24e8ad42db18868a01921b4ac3199ce810e8a8d621697177c705d9
MD5 fc4c02a191d267a4a0427ae64ad0e2b3
BLAKE2b-256 de03b52314df49925f3d2ef5aab4aaf571abe1c2d288095e6402132003034c67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ShanHeuniversity-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de2620686b819984792ebe3d0da9ec4b3e0764d9a593dcbc8acef8a1fbb555dd
MD5 79f2a9a4b5962129f4d0835d5fbfa5c9
BLAKE2b-256 97da6772920e27f403bbed8eeaef4a391135a1e40ac21ebabe216b09451290f1

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