-
-
Notifications
You must be signed in to change notification settings - Fork 770
Expand file tree
/
Copy pathreplicate_example.py
More file actions
30 lines (23 loc) · 715 Bytes
/
replicate_example.py
File metadata and controls
30 lines (23 loc) · 715 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
"""
Basic example of using Replicate with PraisonAI
"""
from praisonaiagents import Agent
# Initialize Agent with Replicate
agent = Agent(
instructions="You are a helpful assistant",
llm="replicate/meta/llama-3.1-8b-instruct",
)
# Example conversation
response = agent.start("Hello! Can you help me with a creative task?")
# Example with creative writing
creative_task = """
Write a short story about a robot learning to paint.
Make it engaging and about 100 words.
"""
response = agent.start(creative_task)
# Example with problem solving
problem_task = """
Solve this problem step by step:
If a train travels at 60 mph for 2.5 hours, how far does it travel?
"""
response = agent.start(problem_task)