@@ -12,18 +12,19 @@ Once you set up the environment, create a Python script which will execute the A
1212### Option A
1313- Clone the repository
1414``` bash
15+ cd ~
1516git clone https://github.com/jc2409/ai-agent.git
1617```
1718
1819### Option B
1920- Creat a Python file:
2021``` bash
22+ cd ~
2123touch agent.py
2224```
2325
2426- Copy and paste the following code:
2527``` bash
26- import os
2728from enum import Enum
2829from typing import Union
2930from pydantic import BaseModel, Field
@@ -36,16 +37,17 @@ from llama_cpp_agent import MessagesFormatterType
3637from llama_cpp_agent import LlamaCppAgent
3738from llama_cpp_agent.providers import LlamaCppPythonProvider
3839from llama_cpp import Llama
39- # from langchain_community.tools import TavilySearchResults // Uncomment this to enable search function
40- from dotenv import load_dotenv
40+ # import os
41+ # from dotenv import load_dotenv
42+ # from langchain_community.tools import TavilySearchResults # Uncomment this to enable search function
4143
4244
43- load_dotenv ()
45+ # load_dotenv()
4446
45- os.environ.get(" TAVILY_API_KEY" )
47+ # os.environ.get("TAVILY_API_KEY")
4648
4749llama_model = Llama(
48- model_path=" ./models/llama3.1-8b-instruct.Q4_0_arm.gguf" , // make sure you use the correct path for the quantized model
50+ model_path=" ./models/llama3.1-8b-instruct.Q4_0_arm.gguf" , # make sure you use the correct path for the quantized model
4951 n_batch=2048,
5052 n_ctx=10000,
5153 n_threads=64,
@@ -112,7 +114,7 @@ def calculator(
112114 else:
113115 raise ValueError(" Unknown operation." )
114116
115- // Uncomment the following function to enable web search functionality (You will need to install langchain-community)
117+ # Uncomment the following function to enable web search functionality (You will need to install langchain-community)
116118# def search_from_the_web(content: str):
117119# """
118120# Search useful information from the web to answer User's question
@@ -174,4 +176,10 @@ if __name__ == '__main__':
174176You are now ready to test the AI Agent. Use the following command in a terminal to start the application:
175177` ` ` bash
176178python3 agent.py
177- ` ` `
179+ ` ` `
180+
181+ {{% notice Note %}}
182+
183+ If it takes too long to process, try to terminate the application and try again.
184+
185+ {{% /notice %}}
0 commit comments