adit94 commited on
Commit
c5d6b7e
1 Parent(s): 78ddddf

Upload 3 files

Browse files
Files changed (3) hide show
  1. config.py +0 -0
  2. constants.py +5 -0
  3. openai_constants.py +146 -0
config.py ADDED
File without changes
constants.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ MONGO_DB = "dock-cms-agenda"
2
+ DOCUMENT_COLLECTION = "documents"
3
+
4
+ BASE_PATH = ""#"/apps/"
5
+
openai_constants.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GPT35_PRICING = {
2
+ "input":0.0015,
3
+ "output":0.002
4
+ }
5
+
6
+ ########################### Entity extraction
7
+ ENTITY_EXTRACTION_PROMPT = f"""
8
+ Being a german insurance document reviewing expert, your task is to perform a step by step review of the insurance provided to ease job of clients.
9
+ It is crucial to avoid hallucinations or adding any information not present in the document.
10
+ The data has personal data masked with the entity type followed by a number to make sure the
11
+ confidential data is preserved.
12
+ ---------------------------------
13
+ Rules on data extraction ::
14
+ Make sure the data and entities extracted are as from the document with same language and no information
15
+ to be added that is not present in the document.
16
+
17
+ I know you’ll do great!
18
+ """
19
+
20
+ ENTITY_EXTRACTION_FUNCTION = [
21
+ {
22
+ 'name': 'extract_insurance_info',
23
+ 'description': 'Extract insurance information from the document. Make sure to extract \
24
+ only if data is present and not to generate data not present in the document. I know you’ll do great!',
25
+ 'parameters': {
26
+ 'type': 'object',
27
+ 'properties': {
28
+ 'sum_insured': {
29
+ 'type': 'string',
30
+ 'description': 'The maximum amount that will be paid in event of claim'
31
+ },
32
+ 'scope_of_cover':{
33
+ 'type':'array',
34
+ 'description':'All relevant scope of insurance cover related information present in the document. ',
35
+ 'items': {
36
+ 'type':'object',
37
+ 'properties':{
38
+ 'scope': { 'type': "string", 'description': "Scope of insurance cover related information found in the document" },
39
+ }
40
+ }},
41
+ 'special_conditions':{
42
+ 'type':'array',
43
+ 'description':'All special conditions related information present in the document. exclusions, special agreements,conditions, etc.',
44
+ 'items': {
45
+ 'type':'object',
46
+ 'properties':{
47
+ 'condition': { 'type': "string", 'description': "exclusions, special condition or terms provided in the document" },
48
+ }
49
+ }},
50
+ 'notice_period_to_terminate_insurace':{
51
+ 'type':'number',
52
+ 'description': 'Date or time period a party has to give prior intimation/notice to terminate the insurance. Eg:30 days'
53
+ },
54
+ 'contract_term':{
55
+ 'type':'string',
56
+ 'description': 'Time period for which the insurace will be valid. Eg. 1year, 3years'
57
+ },
58
+ 'excess_amount': {
59
+ 'type': 'string',
60
+ 'description': 'amount that the insured person is responsible in the event of claim.'
61
+ },
62
+ 'total_premium_amount': {
63
+ 'type': 'string',
64
+ 'description': 'total amount of insurance premium to be paid over the contract period'
65
+ },
66
+ 'premium_amount': {
67
+ 'type': 'string',
68
+ 'description': 'amount of insurance premium to be paid at a specific interval'
69
+ },
70
+ 'premium_interval': {
71
+ 'type': 'string',
72
+ 'description': 'interval over which the insurance premium has to be paid'
73
+ },
74
+ }
75
+ }
76
+ }
77
+ ]
78
+
79
+ ########################### Claim rejection
80
+ CLAUSE_REJECTION_SYSTEM_PROMPT = f"""
81
+ From the given details of insurance document, explain with good reasoning skills based on the \
82
+ query why the claim was rejected.
83
+ """
84
+ CLAUSE_REJECTION_FUNCTION = [
85
+ {
86
+ 'name': 'clause_rejection_reason',
87
+ 'description': 'given the insurance details and the query explain the reason for rejection',
88
+ 'parameters': {
89
+ 'type': 'object',
90
+ 'properties': {
91
+ 'reason': {
92
+ 'type': 'string',
93
+ 'description': 'reason to the provided query for claim rejection based on the insurance details'
94
+ }
95
+ },
96
+ 'required': ['answer'],
97
+ }
98
+ }
99
+ ]
100
+
101
+ ########################### Insurance document FAQ
102
+ DOCUMENT_FAQ_SYSTEM_PROMPT = f"""
103
+ From the given document, answer the question asked.
104
+ """
105
+
106
+ DOCUMENT_FAQ_FUNCTION = [
107
+ {
108
+ 'name': 'document_faq',
109
+ 'description': 'answer the question given the insurance document details.',
110
+ 'parameters': {
111
+ 'type': 'object',
112
+ 'properties': {
113
+ 'answer': {
114
+ 'type': 'string',
115
+ 'description': 'answer to the provided question based on the document'
116
+ }
117
+ },
118
+ 'required': ['answer'],
119
+ }
120
+ }
121
+ ]
122
+
123
+ ########################### Intent classification
124
+ INTENT_CLASSIFICATION_PROMPT = f"""
125
+ You are in charge of identifying the chatbot intent or the category of the question asked to a chatbot provided the given intents.
126
+
127
+ """
128
+
129
+ INTENT_CLASSIFICATION_FUNCTION = [
130
+ {
131
+ 'name': 'intent_classification',
132
+ 'description': 'classify the chatbot intent given the question asked by a user',
133
+ 'parameters': {
134
+ 'type': 'object',
135
+ 'properties': {
136
+ 'intent': {
137
+ 'type': 'string',
138
+ "enum": ["document faq", "claim rejection"],
139
+ 'description': 'answer to the provided question based on the document'
140
+ }
141
+ },
142
+ 'required': ['intent'],
143
+ }
144
+ }
145
+ ]
146
+