23 lines
565 B
Plaintext
23 lines
565 B
Plaintext
import ollama
|
|
import requests
|
|
from IPython.display import Markdown, display
|
|
|
|
OLLAMA_API = "http://localhost:11434/api/chat"
|
|
HEADERS = {"Content-Type": "application/json"}
|
|
MODEL = "llama3.2"
|
|
|
|
# Create a messages list (Note that "system" role is not required)
|
|
messages = [
|
|
{ "role": "user", "content": "Describe some of the business applications of Generative AI"}
|
|
]
|
|
|
|
payload = {
|
|
"model": MODEL,
|
|
"messages": messages,
|
|
"stream": False
|
|
}
|
|
|
|
response = requests.post(OLLAMA_API, json=payload, headers=HEADERS)
|
|
print(response.json()['message']['content'])
|
|
|