mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-27 07:54:19 +00:00
refactor: 重构openai包基础组件架构
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import typing
|
||||
import enum
|
||||
import pydantic
|
||||
|
||||
|
||||
class MessageRole(enum.Enum):
|
||||
|
||||
SYSTEM = 'system'
|
||||
|
||||
USER = 'user'
|
||||
|
||||
ASSISTANT = 'assistant'
|
||||
|
||||
FUNCTION = 'function'
|
||||
|
||||
|
||||
class FunctionCall(pydantic.BaseModel):
|
||||
name: str
|
||||
|
||||
args: dict[str, typing.Any]
|
||||
|
||||
|
||||
class Message(pydantic.BaseModel):
|
||||
|
||||
role: MessageRole
|
||||
|
||||
content: typing.Optional[str] = None
|
||||
|
||||
function_call: typing.Optional[FunctionCall] = None
|
||||
Reference in New Issue
Block a user