Skip to content

Commit

Permalink
Improve RIS
Browse files Browse the repository at this point in the history
  • Loading branch information
EhsanBitaraf committed Feb 13, 2024
1 parent a552cf0 commit b741f37
Show file tree
Hide file tree
Showing 11 changed files with 329 additions and 133 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Build and Publish Package
on:
pull_request:
branches: [main]
push:
branches: [main]
# push:
# branches: [main]

jobs:
build:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Changelog
All notable changes to this project will be documented in this file.

## v0.0.6 2024-02-13
### Task
/triplea/service/llm/__init__.py", line 55
raise Exception("chera")

### Improvements

### Bug Fixes


## v0.0.5 2023-12-28

### Task
Expand Down
32 changes: 32 additions & 0 deletions jupyter_lab/sample-export-engine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from triplea.schemas.article import Article
from triplea.service.repository.export.engine import export_engine


def fx_filter(article:Article):
for i in article.ReviewLLM:
if i['TemplateID'] == "Ass11":
return True
# Finally
return False


def fx_transform(article:Article):
for i in article.ReviewLLM:
if i['TemplateID'] == "Ass11":
if 'D' in i['Response']:
return { "Out" : i['Response']['D'] }

return ""

def fx_output(output):
if 'Out' in output:
return output['Out']

if __name__ == "__main__":
ol = export_engine(fx_filter,fx_transform,fx_output,limit_sample=100)
f = open("outputfile.txt", "a")
for o in ol:
if o is not None:
if o != "":
f.write(f"{o}\n")
f.close()
12 changes: 12 additions & 0 deletions llm_template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# LLM Template



# Version


## 0.0.2
- Add `response_must_be_json`
- Add `stop_immediately`

## 0.0.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version" : "0.0.1",
"version" : "0.0.2",
"stop_immediately": 0,
"model_template_id": "T102",
"model_name": "mistralai_Mistral-7B-Instruct-v0.2",
Expand Down
15 changes: 15 additions & 0 deletions llm_template/ass11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version" : "0.0.2",
"stop_immediately": 0,
"model_template_id": "Ass11",
"model_name": "mistralai_Mistral-7B-Instruct-v0.2",
"base_path":"http://localhost:5003/v1",
"temperature": 0.7,
"frequency_penalty": 0,
"presence_penalty": 0,
"max_tokens": 500,
"top_p": 0.9,
"response_must_be_json": true,
"template": "Evaluate the title and abstract of the article below regarding its connection to LLMs (Large Language Models) Evaluation and Assessment. Determine whether there is a link to the medical field and/or clinical practice. Should such a relationship exist, identify the appropriate medical subcategory from the list below: Anesthesiology, Cardiology, Dermatology, Endocrinology, Gastroenterology, Hematology, Infectious Diseases, Neurology, Oncology, Ophthalmology, Orthopedics, Pathology, Pediatrics, Psychiatry, Radiology, Surgery, Allergology, Critical Care Medicine, Emergency Medicine, Geriatrics, Immunology, Nuclear Medicine, Palliative Care, Plastic & Reconstructive Surgery, Public Health, Sports Medicine or etc. \ntitle: {title} \nabstract : {abstract} \nPrepare my answer as below structure (JSON schema) in JSON format: \nField A: This article related to Evaluation and Assessment of LLMs (Large Language Models).The answer should be True or False. \nField B: Determine whether there is a link to the medical field and/or clinical practice.The answer should be True or False. \nField C: This article related to Evaluation and Assessment of LLMs (Large Language Models) in medical field and/or clinical practice.The answer should be True or False. \nField D: What medical subcategory is the subject of the research related to, for example, cardiology or urology or pharmacology? \nField E: Description. Any additional explanation you want to give is not placed in other fields.\n JSON sample:\n{{\"A\": true, \"B\": true, \"C\": true,\"D\": \"cardiology\", \"E\": \"Description\"}}\nNote that the output format must be JSON."

}
20 changes: 17 additions & 3 deletions main-requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,38 @@
# #-------------------------Reset LLM Respose With Specific Response--------

# #-------------------------Reset FlagShortReviewByLLM to 0 with fx----------
# def my_fx(TemplateID,lr):

# def my_fx(TemplateID, lr):
# # True Must Be Updated
# for r in lr:
# if 'Response' in r:
# if r['Response'] == 'Yes,':
# return True
# elif r['Response'] == 'Yes':
# return True
# elif r['Response'] == 'No' or r['Response'] == '"No' or r['Response'] == 'No,' or r['Response'] == 'No.':
# return False
# elif r['Response'][:3] == 'No,':
# return False
# elif r['Response'][:4] == 'Yes,':
# return True

# else:

# # print(r['Response'])
# return True
# else:
# print(r)
# return False


# reset_flag_llm_by_function("T101",my_fx,limit_sample=0)
# print()
# #-------------------------Reset FlagShortReviewByLLM to 0 with fx----------

# Export
# -------------------------------Export csvs-------------------------------
# export_triplea_csvs_in_relational_mode_save_file("export.csv",limit_sample=120)

# -------------------------------Export csvs-------------------------------



Expand Down
Loading

0 comments on commit b741f37

Please sign in to comment.