Skip to content

Commit 603ec9b

Browse files
authored
Refactor BaseMessage add CodePrompt (camel-ai#139)
1 parent 4b5a8bf commit 603ec9b

File tree

11 files changed

+928
-362
lines changed

11 files changed

+928
-362
lines changed

camel/messages.py

Lines changed: 0 additions & 279 deletions
This file was deleted.

camel/messages/__init__.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
2+
# Licensed under the Apache License, Version 2.0 (the “License”);
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an “AS IS” BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
14+
from typing import Dict, Union
15+
16+
OpenAISystemMessage = Dict[str, str]
17+
OpenAIAssistantMessage = Dict[str, str]
18+
OpenAIUserMessage = Dict[str, str]
19+
OpenAIChatMessage = Union[OpenAIUserMessage, OpenAIAssistantMessage]
20+
OpenAIMessage = Union[OpenAISystemMessage, OpenAIChatMessage]
21+
22+
from .base import BaseMessage # noqa: E402
23+
from .system_messages import ( # noqa: E402
24+
SystemMessage, AssistantSystemMessage, UserSystemMessage,
25+
)
26+
from .chat_messages import ( # noqa: E402
27+
ChatMessage, AssistantChatMessage, UserChatMessage,
28+
)
29+
30+
MessageType = Union[BaseMessage, SystemMessage, AssistantSystemMessage,
31+
UserSystemMessage, ChatMessage, AssistantChatMessage,
32+
UserChatMessage]
33+
SystemMessageType = Union[SystemMessage, AssistantSystemMessage,
34+
UserSystemMessage]
35+
ChatMessageType = Union[ChatMessage, AssistantChatMessage, UserChatMessage]
36+
37+
__all__ = [
38+
'OpenAISystemMessage',
39+
'OpenAIAssistantMessage',
40+
'OpenAIUserMessage',
41+
'OpenAIChatMessage',
42+
'OpenAIMessage',
43+
'BaseMessage',
44+
'SystemMessage',
45+
'AssistantSystemMessage',
46+
'UserSystemMessage',
47+
'ChatMessage',
48+
'AssistantChatMessage',
49+
'UserChatMessage',
50+
'MessageType',
51+
'SystemMessageType',
52+
'ChatMessageType',
53+
]

0 commit comments

Comments
 (0)