跳转到主要内容

CoCo(对话组件) SDK 用于构建模块化聊天机器人

项目描述

CoCoHub SDK 用于在Python代码中使用组件

https://www.conversationalcomponents.com

asciicast

安装

pip install coco-sdk

支持异步

pip install coco-sdk[async]

用法

import coco
import uuid

session_id = str(uuid.uuid4()) # generate a random session id

# directly calling exchange:
response = coco.exchange("namer_vp3", session_id, user_input="hello") # namer_vp3 is CoCoHub component

# using ConversationalComponent API
comp = coco.ConversationalComponent("namer_vp3")
response = comp(session_id, "hello")

# using ComponentSession API
session_with_component = coco.ComponentSession("namer_vp3") 
response = session_with_component("hello")

异步

import coco.async_api as coco

# directly calling exchange:
response = await coco.exchange("namer_vp3", session_id, user_input="hello") # namer_vp3 is CoCoHub component

# using ConversationalComponent API
comp = coco.ConversationalComponent("namer_vp3")
response = await comp(session_id, "hello")

# using ComponentSession API
session_with_component = coco.ComponentSession("namer_vp3") 
response = await session_with_component("hello")

项目详情


下载文件

下载适合您平台的应用程序。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

coco-sdk-0.1.13.tar.gz (8.0 kB 查看哈希值)

上传时间:

构建分布

coco_sdk-0.1.13-py3-none-any.whl (10.0 kB 查看散列值)

上传时间: Python 3

由以下支持