LlamaIndex
Show me reference photos for winter trips in Japan with the help of LlamaIndex and Vity Toolkit in less than 15 lines
In this guide you'll learn how to implement and use Vity Toolkit with LlamaIndex in just a few lines of code. For the purpose of this example, we'll create an assistant that can searches for photos using Pexels.
Show me reference photos for winter trips in Japan
In this example, we will use LlamaIndex to searches for photos from Pexels using Vity Toolkit.
2
Initialize Vity Toolkit.
import { agent } from "@llamaindex/workflow";
import { openai } from "@llamaindex/openai";
import { App, LlamaIndexToolkit } from "vity-toolkit";
const P = (globalThis as any).process;
const apiKey = P?.env?.OPENAI_API_KEY;
const toolkit = new LlamaIndexToolkit({
userPrivateKey: P?.env?.SOLANA_PRIVATE_KEY,
appPrivateKey: P?.env?.SOLANA_PRIVATE_KEY,
});4
Define the Agent.
const pexelsAgent = agent({
name: "Pexels Agent",
description: "An agent that searches for photos using Pexels",
llm: openai({ model: "gpt-4o-mini", apiKey }),
systemPrompt: "You are a travel assistant that curates inspiring visuals. Use the available tools to search for photos.",
tools,
});Last updated
