66
77import json
88import requests
9- from typing import Optional , Dict , Any
9+ from typing import Optional , Dict , Any , List
1010
1111import tuneapi .utils as tu
1212import tuneapi .types as tt
@@ -113,7 +113,8 @@ def chat(
113113 max_tokens : int = 1024 ,
114114 temperature : float = 0.7 ,
115115 token : Optional [str ] = None ,
116- timeout = (5 , 30 ),
116+ timeout = (5 , 60 ),
117+ stop : Optional [List [str ]] = None ,
117118 ** kwargs ,
118119 ) -> str | Dict [str , Any ]:
119120 output = ""
@@ -124,6 +125,7 @@ def chat(
124125 temperature = temperature ,
125126 token = token ,
126127 timeout = timeout ,
128+ stop = stop ,
127129 ** kwargs ,
128130 ):
129131 if isinstance (x , dict ):
@@ -140,7 +142,7 @@ def stream_chat(
140142 temperature : float = 0.7 ,
141143 token : Optional [str ] = None ,
142144 timeout = (5 , 60 ),
143- stop_sequence : Optional [str ] = None ,
145+ stop : Optional [List [ str ] ] = None ,
144146 raw : bool = False ,
145147 debug : bool = False ,
146148 ):
@@ -157,8 +159,8 @@ def stream_chat(
157159 "stream" : True ,
158160 "max_tokens" : max_tokens ,
159161 }
160- if stop_sequence :
161- data ["stop_sequence " ] = stop_sequence
162+ if stop :
163+ data ["stop " ] = stop
162164 if isinstance (chats , tt .Thread ) and len (chats .tools ):
163165 data ["tools" ] = [
164166 {"type" : "function" , "function" : x .to_dict ()} for x in chats .tools
0 commit comments