6
6
import os
7
7
import re
8
8
from datetime import datetime , timezone
9
+ from typing import List
9
10
10
11
import boto3
11
12
from apiflask import APIBlueprint
33
34
emails = APIBlueprint ("emails" , __name__ , url_prefix = "/emails" , tag = "Emails" )
34
35
35
36
36
- def thread_emails_to_openai_messages (thread_emails : list [Email ]) -> list [OpenAIMessage ]:
37
+ def thread_emails_to_openai_messages (thread_emails : List [Email ]) -> List [OpenAIMessage ]:
37
38
"""Converts list of email to openai messages.
38
39
39
- Parameters:
40
- ----------
41
- thread_email_ids : :obj:`list` of :obj:`Email`
42
- list of email ids
40
+ Args:
41
+ thread_emails: list of emails
43
42
44
43
Returns:
45
- -------
46
- :obj:`list` of :obj:`OpenAIMessage`
47
44
list of openai messages
48
45
"""
49
46
openai_messages = []
@@ -54,11 +51,11 @@ def thread_emails_to_openai_messages(thread_emails: list[Email]) -> list[OpenAIM
54
51
55
52
56
53
def document_data (
57
- documents : dict [str , list [RedisDocument ]],
58
- ) -> tuple [list [str ], list [ list [int ]], list [ list [float ]]]:
54
+ documents : dict [str , List [RedisDocument ]],
55
+ ) -> tuple [List [str ], List [ List [int ]], List [ List [float ]]]:
59
56
"""Process raw openai document output.
60
57
61
- Parameters
58
+ Args:
62
59
----------
63
60
documents : :obj:`list` of :obj:`dict`
64
61
raw openai document output
@@ -88,14 +85,13 @@ def document_data(
88
85
return questions , doc_ids , doc_confidences
89
86
90
87
91
- def increment_response_count (document_ids : list [ list [int ]]):
88
+ def increment_response_count (document_ids : List [ List [int ]]):
92
89
"""Increment response count for documents.
93
90
94
- Parameters
95
- ----------
96
- document_ids : :obj:`list` of :obj:`list` of :obj:`int`
97
- list of document ids. each element in the list is a list of document ids used to
98
- answer a specific question
91
+ Args:
92
+ document_ids : :obj:`list` of :obj:`list` of :obj:`int`
93
+ list of document ids. each element in the list is a list of document ids
94
+ used to answer a specific question
99
95
"""
100
96
for doc_ids_question in document_ids :
101
97
for doc_id in doc_ids_question :
@@ -105,14 +101,13 @@ def increment_response_count(document_ids: list[list[int]]):
105
101
db .session .commit ()
106
102
107
103
108
- def decrement_response_count (document_ids : list [ list [int ]]):
104
+ def decrement_response_count (document_ids : List [ List [int ]]):
109
105
"""Decrement response count for documents.
110
106
111
- Parameters
112
- ----------
113
- document_ids : :obj:`list` of :obj:`list` of :obj:`int`
114
- list of document ids. each element in the list is a list of document ids used to
115
- answer a specific question
107
+ Args:
108
+ document_ids : :obj:`list` of :obj:`list` of :obj:`int`
109
+ list of document ids. each element in the list is a list of document ids
110
+ used to answer a specific question
116
111
"""
117
112
for doc_ids_question in document_ids :
118
113
for doc_id in doc_ids_question :
0 commit comments