44
55class Chatbot :
66 """
7- Chatbot object, used to manage or query chatbots.
8-
9- Create and interact with chatbots:
10-
11- >>> chatbot = project.chatbots.create('my_chatbot', model_name='gpt-4')
12- >>> response = chatbot.ask('Hello! How are you?')
13-
7+ Represents a chatbot that can be managed within a project.
148 """
159
1610 def __init__ (self , api , project , data : dict ):
@@ -27,15 +21,17 @@ def __repr__(self):
2721
2822 def update (self , name : str = None , agent_name : str = None , model_name : str = None , database_name : str = None , inplace : bool = False ):
2923 """
30- Update chatbot properties.
24+ Updates the chatbot's properties.
3125
32- >>> chatbot.update(model_name='gpt-4', database_name='slack_db')
26+ Example usage:
27+ >>> chatbot.update(model_name='gpt-4', database_name='slack_db')
3328
34- :param name: New name for the chatbot.
35- :param model_name: New model to use for the chatbot.
36- :param database_name: New database connection name.
37- :param inplace: If True, updates the current object in-place.
38- :return: Updated Chatbot object or None if inplace is True.
29+ :param name: (Optional) New name for the chatbot.
30+ :param agent_name: (Optional) New agent name to associate with the chatbot.
31+ :param model_name: (Optional) New model to use for the chatbot.
32+ :param database_name: (Optional) New database connection name.
33+ :param inplace: If True, updates the current object in-place; otherwise, returns a new Chatbot object.
34+ :return: Updated Chatbot object, or None if inplace is True.
3935 """
4036 payload = {}
4137
@@ -68,36 +64,37 @@ def update(self, name: str = None, agent_name: str = None, model_name: str = Non
6864
6965 def delete (self ):
7066 """
71- Delete the chatbot.
72-
73- >>> chatbot.delete()
67+ Deletes the chatbot from the project.
7468
69+ Example usage:
70+ >>> chatbot.delete()
7571 """
7672 self .api .delete_chatbot (self .project .name , self .name )
7773
7874
7975class Chatbots (CollectionBase ):
8076 """
81- Chatbots
82-
83- Manage chatbots within a project.
84-
85- List chatbots:
86-
87- >>> chatbots = project.chatbots.list()
88-
89- Get chatbot by name:
77+ Manages chatbots within a project.
9078
91- >>> chatbot = project. chatbots.get('my_chatbot')
79+ Provides methods to list, retrieve, create, and delete chatbots.
9280
93- Create a chatbot :
81+ Example usage :
9482
95- >>> chatbot = project.chatbots.create('my_chatbot', model_name='gpt-4')
83+ List chatbots in a project:
84+ >>> chatbots = project.chatbots.list()
9685
97- Delete a chatbot:
86+ Retrieve a chatbot by name:
87+ >>> chatbot = project.chatbots.get('my_chatbot')
9888
99- >>> project.chatbots.drop('my_chatbot')
89+ Create a new chatbot:
90+ >>> chatbot = project.chatbots.create(
91+ ... 'my_chatbot',
92+ ... model_name='gpt-4',
93+ ... database_name='slack_db'
94+ ... )
10095
96+ Delete a chatbot by name:
97+ >>> project.chatbots.drop('my_chatbot')
10198 """
10299
103100 def __init__ (self , project , api ):
@@ -106,11 +103,12 @@ def __init__(self, project, api):
106103
107104 def list (self ) -> List [Chatbot ]:
108105 """
109- Get the list of chatbots in the project.
106+ Retrieves a list of all chatbots within the project.
110107
111- >>> chatbots = project.chatbots.list()
108+ Example usage:
109+ >>> chatbots = project.chatbots.list()
112110
113- :return: List of chatbot objects.
111+ :return: List of Chatbot objects.
114112 """
115113 return [
116114 Chatbot (self .api , self .project , item )
@@ -119,36 +117,39 @@ def list(self) -> List[Chatbot]:
119117
120118 def get (self , name : str ) -> Chatbot :
121119 """
122- Get a chatbot by name.
120+ Retrieves a chatbot by its name.
123121
124- >>> chatbot = project.chatbots.get('my_chatbot')
122+ Example usage:
123+ >>> chatbot = project.chatbots.get('my_chatbot')
125124
126- :param name: Name of the chatbot.
125+ :param name: The name of the chatbot to retrieve .
127126 :return: Chatbot object.
128127 """
129128 data = self .api .get_chatbot (self .project .name , name )
130129 return Chatbot (self .api , self .project , data )
131130
132131 def create (self , name : str , agent_name : str = None , model_name : str = None , database_name : str = None , is_running : bool = False ) -> Chatbot :
133132 """
134- Create a new chatbot.
135-
136- >>> chatbot = project.chatbots.create(
137- ... 'my_chatbot',
138- ... model_name='gpt-4',
139- ... database_name='slack_db'
140-
141- ... )
142-
143- :param name: Name of the chatbot.
144- :param model_name: Name of the model or agent.
145- :param database_name: Connection name for chat applications (e.g., Slack, Teams).
146- :return: Created Chatbot object.
133+ Creates a new chatbot within the project.
134+
135+ Example usage:
136+ >>> chatbot = project.chatbots.create(
137+ ... 'my_chatbot',
138+ ... model_name='gpt-4',
139+ ... database_name='slack_db'
140+ ... )
141+
142+ :param name: The name of the new chatbot.
143+ :param agent_name: The agent name to associate with the chatbot.
144+ :param model_name: The model to use for the chatbot.
145+ :param database_name: The database connection name for chat applications.
146+ :param is_running: (Optional) Indicates whether the chatbot should start in a running state. Default is False.
147+ :return: The created Chatbot object.
147148 """
148149 payload = {
149150 'name' : name ,
150151 'database_name' : database_name ,
151- 'is_running' :is_running
152+ 'is_running' : is_running
152153 }
153154
154155 if agent_name :
@@ -163,10 +164,11 @@ def create(self, name: str, agent_name: str = None, model_name: str = None, data
163164
164165 def drop (self , name : str ):
165166 """
166- Delete a chatbot by name.
167+ Deletes a chatbot by its name.
167168
168- >>> project.chatbots.drop('my_chatbot')
169+ Example usage:
170+ >>> project.chatbots.drop('my_chatbot')
169171
170- :param name: Name of the chatbot to delete.
172+ :param name: The name of the chatbot to delete.
171173 """
172174 self .api .delete_chatbot (self .project .name , name )
0 commit comments