AItrika
1.0.0

增強您在醫學研究方面的知識。
Aitrika(以前是Pubgpt )是一種工具,可以以一種簡單的方式提取大量相關信息:
等等!
您可以通過運行:
streamlit run app.py
或者,您可以通過運行:
python main.py
要安裝所有內容,您需要uv 。
首先,使用命令安裝uv :
python main.py
之後,使用命令創建虛擬環境:
uv venv venv_name
激活虛擬env:
source venv_name/bin/activate
並安裝依賴項:
uv pip install -r requirements.in
為了設置API鍵,請將您的密鑰插入env.example文件並將其重命名為.env 。
您可以通過通過PubMed ID來輕鬆獲取論文的信息:
from aitrika . engine . aitrika import OnlineAItrika
aitrika_engine = OnlineAItrika ( pubmed_id = pubmed_id )
title = aitrika_engine . get_title ()
print ( title )或者您可以解析本地PDF:
from aitrika . engine . aitrika import LocalAItrika
aitrika_engine = LocalAItrika ( pdf_path = pdf_path )
title = aitrika_engine . get_title ()
print ( title ) Breast cancer genes: beyond BRCA1 and BRCA2.
您可以獲得其他信息,例如基因和疾病之間的關聯:
associations = aitrika_engine . get_associations () [
{
"gene": "BRIP1",
"disease": "Breast Neoplasms"
},
{
"gene": "PTEN",
"disease": "Breast Neoplasms"
},
{
"gene": "CHEK2",
"disease": "Breast Neoplasms"
},
]
...
或者,您可以獲得一個不錯的格式數據框架:
associations = aitrika_engine . associations ( dataframe = True ) gene disease
0 BRIP1 Breast Neoplasms
1 PTEN Breast Neoplasms
2 CHEK2 Breast Neoplasms
...
借助抹布的力量,您可以查詢文檔:
## Prepare the documents
documents = generate_documents ( content = abstract )
## Set the LLM
llm = GroqLLM ( documents = documents , api_key = os . getenv ( "GROQ_API_KEY" ))
## Query your document
query = "Is BRCA1 associated with breast cancer?"
print ( llm . query ( query = query )) The provided text suggests that BRCA1 is associated with breast cancer, as it is listed among the high-penetrance genes identified in family linkage studies as responsible for inherited syndromes of breast cancer.
或者您可以提取其他信息:
results = engine . extract_results ( llm = llm )
print ( results ) ** RESULTS **
- High-penetrance genes - BRCA1, BRCA2, PTEN, TP53 - responsible for inherited syndromes
- Moderate-penetrance genes - CHEK2, ATM, BRIP1, PALB2, RAD51C - associated with moderate BC risk
- Low-penetrance alleles - common alleles - associated with slightly increased or decreased risk of BC
- Current clinical practice - high-penetrance genes - widely used
- Future prospect - all familial breast cancer genes - to be included in genetic test
- Research need - clinical management - of moderate and low-risk variants
要運行Aitrika API,請按照以下步驟:
確保您已經設置了環境,並如安裝部分所述安裝了所有依賴關係。
使用以下命令運行API服務器:
python api.pyAPI將開始在http://0.0.0.0:8000上運行。您現在可以向各種端點提出請求:
您可以使用Curl,Postman或任何HTTP客戶端等工具與API進行交互。例如:
curl -X POST " http://localhost:8000/abstract " -H " Content-Type: application/json " -d ' {"pubmed_id": 12345678} ' API文檔將自動生成並保存到docs/api-reference/openapi.json 。您可以將此文件與Swagger UI之類的工具一起使用,以獲得更具交互性的API探索體驗。
如果您覺得這個項目有用,請考慮支持它:
如果您在商業或商業環境中使用此項目,請與我聯繫。
我可以諮詢,定制開發或商業許可。
您的支持有助於使該項目保持活躍並不斷改進。謝謝你!
Aitrika已獲得Apache 2.0許可證的許可。有關更多詳細信息,請參見許可證文件。