Skip to content

Commit

Permalink
fix: removed name parameter from chat message
Browse files Browse the repository at this point in the history
  • Loading branch information
asafgardin committed Jan 7, 2024
1 parent b766c77 commit a34b62a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
4 changes: 1 addition & 3 deletions ai21/models/chat_message.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from dataclasses import dataclass
from typing import Optional

from ai21.models.role_type import RoleType
from ai21.models.ai21_base_model_mixin import AI21BaseModelMixin
from ai21.models.role_type import RoleType


@dataclass
class ChatMessage(AI21BaseModelMixin):
role: RoleType
text: str
name: Optional[str] = None
12 changes: 4 additions & 8 deletions examples/studio/chat.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from ai21 import AI21Client
from ai21.resources import Message, RoleType, Penalty
from ai21.models import ChatMessage, RoleType, Penalty

system = "You're a support engineer in a SaaS company"
messages = [
Message(text="Hello, I need help with a signup process.", role=RoleType.USER, name="Alice"),
Message(
text="Hi Alice, I can help you with that. What seems to be the problem?", role=RoleType.ASSISTANT, name="Bob"
),
Message(
text="I am having trouble signing up for your product with my Google account.", role=RoleType.USER, name="Alice"
),
ChatMessage(text="Hello, I need help with a signup process.", role=RoleType.USER),
ChatMessage(text="Hi Alice, I can help you with that. What seems to be the problem?", role=RoleType.ASSISTANT),
ChatMessage(text="I am having trouble signing up for your product with my Google account.", role=RoleType.USER),
]

client = AI21Client()
Expand Down
3 changes: 1 addition & 2 deletions tests/unittests/clients/studio/resources/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ def get_studio_answer():
def get_studio_chat():
_DUMMY_MODEL = "dummy-chat-model"
_DUMMY_MESSAGES = [
ChatMessage(text="Hello, I need help with a signup process.", role=RoleType.USER, name="Alice"),
ChatMessage(text="Hello, I need help with a signup process.", role=RoleType.USER),
ChatMessage(
text="Hi Alice, I can help you with that. What seems to be the problem?",
role=RoleType.ASSISTANT,
name="Bob",
),
]
_DUMMY_SYSTEM = "You're a support engineer in a SaaS company"
Expand Down

0 comments on commit a34b62a

Please sign in to comment.