-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathclarifai_llm.py
More file actions
34 lines (27 loc) · 917 Bytes
/
clarifai_llm.py
File metadata and controls
34 lines (27 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
from clarifai.client import Model
def main():
# Initialize the model
model = Model(url="https://clarifai.com/qwen/qwenLM/models/QwQ-32B-AWQ")
# Example prompts
prompts = [
"What is the capital of France?",
"Explain quantum computing in simple terms.",
"Write a short poem about artificial intelligence."
]
# Process each prompt
for prompt in prompts:
print(f"\nPrompt: {prompt}")
print("-" * 50)
try:
# Get prediction
response = model.predict(prompt)
print(f"Response: {response}")
except Exception as e:
print(f"Error processing prompt: {str(e)}")
if __name__ == "__main__":
# Ensure PAT is set
if not os.getenv("CLARIFAI_PAT"):
print("Please set your CLARIFAI_PAT environment variable")
exit(1)
main()