You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { tool } from 'llamaindex';
import { agent } from '@llamaindex/workflow';
import { ollama } from '@llamaindex/ollama';
(async () => {
// Define a joke-telling tool
const jokeTool = tool(() => 'Baby Llama is called cria', {
name: 'joke',
description: 'Use this tool to get a joke',
});
// Create an single agent workflow with the tool
const jokeAgent = agent({
tools: [jokeTool],
llm: ollama({ model: 'qwen2.5-coder:14b' }),
});
// Run the workflow
const result = await jokeAgent.run('Tell me something funny');
console.log(result.data.result); // Baby Llama is called cria
console.log('---------------------');
console.log(result.data.message); // { role: 'assistant', content: 'Baby Llama is called cria' }
})().catch(console.error);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I change the example https://developers.llamaindex.ai/typescript/framework/modules/agents/agent_workflow/#single-agent-workflow to work with local LLM by @llamaindex/ollama adapter package:
The output is:
I'm new in the framework, but it looks like this is similar to run-llama/llama_index#17713
Could someone clarify it for me?
Beta Was this translation helpful? Give feedback.
All reactions