Refactor test.py to import necessary modules, update code structure, and retrieve crossref data for dois_checked collection
parent
96c4a13aa5
commit
01c4829564
2 changed files with 16 additions and 15 deletions
@ -0,0 +1,3 @@ |
|||||||
|
version https://git-lfs.github.com/spec/v1 |
||||||
|
oid sha256:622fad792b585088c13bfb2455ab30822083046fb8ae46c79866d568fd8cd8dd |
||||||
|
size 14416 |
||||||
@ -1,19 +1,17 @@ |
|||||||
|
import crossref_commons.retrieval as crossref |
||||||
from _arango import ArangoDB |
from _arango import ArangoDB |
||||||
|
from time import sleep |
||||||
arango = ArangoDB() |
arango = ArangoDB() |
||||||
initiatives = [i for i in arango.db.collection("eu_initiatives").all()] |
|
||||||
ordered_by_headline = sorted(initiatives, key=lambda x: x["headline"]) |
|
||||||
import env_manager |
|
||||||
import os |
|
||||||
from ollama import Client |
|
||||||
import httpx |
|
||||||
|
|
||||||
|
|
||||||
ollama = Client( |
checked = arango.db.collection('dois_checked').all() |
||||||
os.getenv("https://lasseedfast.se/api/chat/"), |
|
||||||
auth=httpx.BasicAuth(username="lasse", password="p239q8wimerxr2m389"), |
|
||||||
) |
|
||||||
|
|
||||||
ollama.generate( |
for doi in checked: |
||||||
"What is the European Green Deal?" |
print(doi) |
||||||
) # This will generate a response from the LLM model |
try: |
||||||
|
crossref_data = crossref.get_publication_as_json(doi['doi']) |
||||||
|
arango.db.collection('dois_checked').update({'_key': doi['_key'], 'crossref_data': crossref_data}) |
||||||
|
sleep(1) |
||||||
|
except Exception as e: |
||||||
|
print(e) |
||||||
|
sleep(1) |
||||||
|
continue |
||||||
|
|||||||
Loading…
Reference in new issue