You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
426 B

import ollama
class Ollama:
def __init__(self, model='llama3:8b-instruct-q5_K_M', temperature=0):
self.model = model
self.temperature = temperature
def generate(self, prompt):
return ollama.generate(prompt=prompt, model=self.model, options={'temperature': self.temperature})['response']
if __name__ == "__main__":
# Example usage
prompt = 'Tell me a joke!'
ollama = Ollama()