Refactor ArangoDB class and script for fetching electric car documents

main
Lasse Studion 2 years ago
parent 576d1a0167
commit d903ce6182
  1. 6
      example_fetch_docs.py

@ -1,7 +1,7 @@
# Example of fetching documents and go though them one by one using Ollama: # Example of fetching documents and go though them one by one using Ollama:
from arango_class import ArangoDB from arango_class import ArangoDB
import ollama from ollama_class import Ollama
# Get the documents where "electric car" is mentioned # Get the documents where "electric car" is mentioned
@ -13,6 +13,8 @@ documents = list(cursor)
# Go though the documents one by one # Go though the documents one by one
ollama = Ollama()
for doc in documents: for doc in documents:
text = doc['translation'] text = doc['translation']
prompt =f"""Below is a transcript of a speech given in the European Parliament. I'm interested in all arguments related to electric cars. prompt =f"""Below is a transcript of a speech given in the European Parliament. I'm interested in all arguments related to electric cars.
@ -20,4 +22,4 @@ for doc in documents:
Please give me a list of all arguments related to electric cars in the text above. One argument per line. Please give me a list of all arguments related to electric cars in the text above. One argument per line.
Answer ONLY with the arguments. Kepp to the information in the text.""" #TODO Make a better prompt! Answer ONLY with the arguments. Kepp to the information in the text.""" #TODO Make a better prompt!
arguments = ollama.generate(prompt=prompt, model='llama3:8b-instruct-q5_K_M', options={'temperature': 0}) arguments = ollama.generate(prompt)

Loading…
Cancel
Save