feat: Add tools strategy
This commit is contained in:
13
src/naliiabot/bot/tools/naliia_tools.py
Normal file
13
src/naliiabot/bot/tools/naliia_tools.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from langchain.tools import tool
|
||||||
|
|
||||||
|
|
||||||
|
class NaliiaTools:
|
||||||
|
|
||||||
|
@tool
|
||||||
|
def verificar_usuario_registrado(self):
|
||||||
|
"""
|
||||||
|
Verifica si el usuario que esta contactandose es un
|
||||||
|
usuario ya conocido y registrado en la base de datos.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return True
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from src.naliiabot.bot.agent.agent import Agent, AgentConfig
|
from src.naliiabot.bot.agent.agent import Agent, AgentConfig
|
||||||
|
from src.naliiabot.bot.tools.naliia_tools import NaliiaTools
|
||||||
from src.naliiabot.bot.factories.llm_factory import LLMFactory
|
from src.naliiabot.bot.factories.llm_factory import LLMFactory
|
||||||
from src.naliiabot.bot.prompts.load_prompt import get_prompt_template
|
from src.naliiabot.bot.prompts.load_prompt import get_prompt_template
|
||||||
|
|
||||||
@@ -16,6 +17,12 @@ def get_agent():
|
|||||||
|
|
||||||
NALIIA_PROMPT = get_prompt_template(
|
NALIIA_PROMPT = get_prompt_template(
|
||||||
"NALIIA_PROMPT")
|
"NALIIA_PROMPT")
|
||||||
|
naliia_tools = [
|
||||||
|
t for t in dir(NaliiaTools()) if not t.startswith('__') and not t.endswith('__')
|
||||||
|
]
|
||||||
|
|
||||||
config = AgentConfig(system_prompt=NALIIA_PROMPT)
|
config = AgentConfig(system_prompt=NALIIA_PROMPT)
|
||||||
model = LLMFactory(MODEL_NAME).get_model()
|
model = LLMFactory(MODEL_NAME).get_model()
|
||||||
return Agent(model=model)
|
|
||||||
|
raise Exception(naliia_tools)
|
||||||
|
return Agent(model=model, config=config, tools=naliia_tools)
|
||||||
|
|||||||
Reference in New Issue
Block a user