File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -55,25 +55,25 @@ class Message(BaseModel):
55
55
role : str
56
56
content : str
57
57
58
- def to_openai (self ) -> dict [ str , str ] :
58
+ def to_openai (self ):
59
59
if self .role .lower () not in ["user" , "assistant" , "system" ]:
60
60
raise ValueError ("Role must be either 'user', 'assistant' or 'system'" )
61
61
return {"role" : self .role , "content" : self .content }
62
62
63
- def to_cohere (self ) -> dict [ str , str ] :
63
+ def to_cohere (self ):
64
64
return {"role" : self .role , "message" : self .content }
65
65
66
66
67
67
class Conversation (BaseModel ):
68
68
messages : list [Message ]
69
69
70
70
def split_by_topic (
71
- self ,
72
- encoder : BaseEncoder ,
73
- threshold : float = 0.5 ,
74
- split_method : Literal [
75
- "consecutive_similarity_drop" , "cumulative_similarity_drop"
76
- ] = "consecutive_similarity_drop" ,
71
+ self ,
72
+ encoder : BaseEncoder ,
73
+ threshold : float = 0.5 ,
74
+ split_method : Literal [
75
+ "consecutive_similarity_drop" , "cumulative_similarity_drop"
76
+ ] = "consecutive_similarity_drop" ,
77
77
) -> dict [str , list [str ]]:
78
78
docs = [f"{ m .role } : { m .content } " for m in self .messages ]
79
79
return semantic_splitter (
You can’t perform that action at this time.
0 commit comments