getting started on the preparedness data
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import requests
|
||||
|
||||
def get_ollama_summary(text, model="gpt-oss:20b"):
|
||||
url = "http://localhost:11434/v1/chat/completions"
|
||||
payload = {
|
||||
"model": model,
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a helpful assistant that summarizes text."},
|
||||
{"role": "user", "content": text}
|
||||
]
|
||||
}
|
||||
response = requests.post(url, json=payload)
|
||||
response.raise_for_status()
|
||||
return response.json()["choices"][0]["message"]["content"]
|
||||
|
||||
def get_ollama_embedding(text, model="nomic-embed-text"):
|
||||
url = "http://localhost:11434/api/embeddings"
|
||||
payload = {
|
||||
"model": model,
|
||||
"prompt": text
|
||||
}
|
||||
response = requests.post(url, json=payload)
|
||||
response.raise_for_status()
|
||||
return response.json()["embedding"]
|
||||
Reference in New Issue
Block a user