find page no. using llm
This commit is contained in:
+11
-14
@@ -123,7 +123,7 @@ if st.session_state.user_info['mail'] in user_list:
|
||||
with field_row[0]:
|
||||
st.write("**Field Group**")
|
||||
with field_row[1]:
|
||||
field_group = st.selectbox('Field Group',('Unique Key', 'Contract Related', 'Pricing Before Carveouts - I'
|
||||
field_group = st.selectbox('Field Group',('Unique and Contract Related', 'Pricing Before Carveouts - I'
|
||||
, 'Pricing Before Carveouts - II', 'Carveout Indicator, Code Type and Code #s - I'
|
||||
, 'Carveout Indicator, Code Type and Code #s - II', 'Carveout Indicator, Code Type and Code #s - III'
|
||||
, 'Optimize Carving Indic.', 'Carveout Method - I', 'Carveout Method - II', 'Provider'
|
||||
@@ -131,10 +131,8 @@ if st.session_state.user_info['mail'] in user_list:
|
||||
|
||||
|
||||
# priorty column will be relaced by group_id in snowflake db
|
||||
if field_group == 'Unique Key':
|
||||
fields = fields[fields['PRIORITY'] == 'A']
|
||||
elif field_group == 'Contract Related':
|
||||
fields = fields[fields['PRIORITY'] == 'C']
|
||||
if field_group == 'Unique and Contract Related':
|
||||
fields = fields[fields['PRIORITY'].isin(['A','C'])]
|
||||
elif field_group == 'Pricing Before Carveouts - I':
|
||||
fields = fields[fields['PRIORITY'] == 'B']
|
||||
fields = np.array_split(fields, 2)[0]
|
||||
@@ -326,7 +324,7 @@ if st.session_state.user_info['mail'] in user_list:
|
||||
Question: {question}
|
||||
Answer: Answer in JSON format: {{"""
|
||||
parameters = {
|
||||
"maxTokenCount":1280,
|
||||
"maxTokenCount":2048,
|
||||
"stopSequences":[],
|
||||
"temperature":0,
|
||||
"topP":0.9
|
||||
@@ -346,7 +344,7 @@ if st.session_state.user_info['mail'] in user_list:
|
||||
Answer: Answer in JSON format: {{"""
|
||||
payload={
|
||||
"prompt":"[INST]"+ prompt_data +"[/INST]",
|
||||
"max_gen_len":1280,
|
||||
"max_gen_len":2048,
|
||||
"temperature":0.0,
|
||||
"top_p":0.9
|
||||
}
|
||||
@@ -368,7 +366,7 @@ if st.session_state.user_info['mail'] in user_list:
|
||||
Assistant: Answer in JSON format: {{"""
|
||||
body = json.dumps(
|
||||
{"prompt": anthropic.HUMAN_PROMPT + prompt_data + anthropic.AI_PROMPT,
|
||||
"max_tokens_to_sample": 1280,
|
||||
"max_tokens_to_sample": 2048,
|
||||
"temperature":0.0,
|
||||
"top_p":1,
|
||||
"top_k":250,
|
||||
@@ -571,8 +569,8 @@ if st.session_state.user_info['mail'] in user_list:
|
||||
df, history, attempt, raw_response_text = run_llm(attempt, bucket, contract_list, llm_selected, field, field_values, history)
|
||||
df_1 = df[['Contract Name','Contract ID', 'Actual Value Stored','New Extracted value','Confidence Level'
|
||||
,'Snippet','Original Page Number', 'New Page Number', 'Revised Prompt', 'Result']]
|
||||
# df.to_csv('results.csv', index=False)
|
||||
# history.to_csv('history.csv', index=False)
|
||||
df.to_csv('results.csv', index=False)
|
||||
history.to_csv('history.csv', index=False)
|
||||
# s3_client.upload_file('results.csv', bucket, key)
|
||||
csv_buf = StringIO()
|
||||
df_1.to_csv(csv_buf, header=True, index=False)
|
||||
@@ -585,10 +583,9 @@ if st.session_state.user_info['mail'] in user_list:
|
||||
df = df[['Contract Name','Contract ID', 'SF_DB_COL_NAME', 'Actual Value Stored','New Extracted value','Confidence Level'
|
||||
,'Snippet','Original Page Number', 'New Page Number', 'Revised Prompt', 'Result']]
|
||||
|
||||
# df = pd.read_csv('results.csv')
|
||||
# df['Result'] = df['Result'].astype('str')
|
||||
# history = pd.read_csv('history.csv')
|
||||
|
||||
df = pd.read_csv('results.csv')
|
||||
df['Result'] = df['Result'].astype('str')
|
||||
history = pd.read_csv('history.csv')
|
||||
st.dataframe(df)
|
||||
st.dataframe(history)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user