1from pathlib import Path
2
3from kern.agent import Agent
4from kern.media import Image
5from kern.models.mistral.mistral import MistralChat
6from kern.tools.hackernews import HackerNewsTools
7
8agent = Agent(
9 model=MistralChat(id="pixtral-12b-2409"),
10 tools=[
11 HackerNewsTools()
12 ], # pixtral-12b-2409 is not so great at tool calls, but it might work.
13 markdown=True,
14)
15
16image_path = Path(__file__).parent.joinpath("sample.jpeg")
17
18agent.print_response(
19 "Tell me about this image and give me the latest news about it from HackerNews.",
20 images=[
21 Image(filepath=image_path),
22 ],
23 stream=True,
24)