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{config}from'dotenv';import{LlamaCpp}from'langchain/llms/llama_cpp';import{initializeAgentExecutorWithOptions}from'langchain/agents';import{Calculator}from'langchain/tools/calculator';import{WebSurf}from'./tools/webSurf';importsystemPromptfrom'./prompts/system_prompts/initialSportsBettingAI';config();constllamaPath='/Users/bklynate/dev_work/aiWorld/llama.cpp/models/13B/ggml-model-q4_0.bin';constmodel=newLlamaCpp({modelPath: llamaPath});consttools=[newCalculator(),newWebSurf()];constexecutor=awaitinitializeAgentExecutorWithOptions(tools,model,{agentType: 'zero-shot-react-description',verbose: true,agentArgs: {systemPrompt: systemPrompt(),},});/* eslint-disable no-console */console.log('Readying Local Model Bot.');construnTask=async(input)=>{console.log(`Executing with input "${input}"...`);letresult;try{console.log('Entered try block.');result=awaitexecutor.call({ input });console.log(`Got output ${result}`);console.log('\n');console.log('HERE IS RESULT',result);console.log('\n');}catch(error){thrownewError(`failed executing task: ${error.message}`);}returnresult?.output??'I found nothing.';};construn=async()=>{constresult=awaitrunTask('What is the current record of the NY Mets for 2023?');returnresult;};console.log(awaitrun());
Judging from the output, it doesn't seem like anything is happening
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.
-
I have a tiny script here:
Judging from the output, it doesn't seem like anything is happening
Is it possible to have Langchain Agents use LlamaCpp, equipping it with tools, to tackle answering inputs?
Beta Was this translation helpful? Give feedback.
All reactions