您可以使用內建 Function: emb 來創建自己的plugin
程式碼區塊 | ||
---|---|---|
| ||
from pyodide.http import pyfetch
import asyncio
params = await infer_params(
conversation=CURRENT_CONVERSATION,
description="""Using embedding model to generate emgedding for input text""",
parameters={
"type": "object",
"properties": {
"text_to_embed": {
"type": "string",
"description": "text to be embedded",
}
},
"required": ["text_to_embed"],
},
)
print(await emb(params['text_to_embed'])) |