Spaces:
Sleeping
Sleeping
Update src/agent/linkedin_agent.py
Browse files
src/agent/linkedin_agent.py
CHANGED
|
@@ -4,7 +4,7 @@ import os
|
|
| 4 |
from openai import OpenAI
|
| 5 |
from agents import Agent
|
| 6 |
from agents import OpenAIResponsesModel
|
| 7 |
-
from tools.web_search_tool import get_web_search_tool
|
| 8 |
|
| 9 |
# Asegúrate de tener la variable de entorno OPENAI_API_KEY definida en tu sistema
|
| 10 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
|
@@ -14,6 +14,7 @@ if not OPENAI_API_KEY:
|
|
| 14 |
# Cliente de OpenAI para pasar al modelo
|
| 15 |
client = OpenAI(api_key=OPENAI_API_KEY)
|
| 16 |
|
|
|
|
| 17 |
def create_agent():
|
| 18 |
"""
|
| 19 |
Crea y retorna un Agent configurado para:
|
|
@@ -29,7 +30,7 @@ def create_agent():
|
|
| 29 |
)
|
| 30 |
|
| 31 |
# 2) Obtenemos el WebSearchTool nativo:
|
| 32 |
-
web_search =
|
| 33 |
|
| 34 |
# 3) Construimos el agente con instrucciones muy explícitas:
|
| 35 |
instrucciones = """
|
|
|
|
| 4 |
from openai import OpenAI
|
| 5 |
from agents import Agent
|
| 6 |
from agents import OpenAIResponsesModel
|
| 7 |
+
from tools.web_search_tool import get_web_search_tool, get_search_tool
|
| 8 |
|
| 9 |
# Asegúrate de tener la variable de entorno OPENAI_API_KEY definida en tu sistema
|
| 10 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
|
|
|
| 14 |
# Cliente de OpenAI para pasar al modelo
|
| 15 |
client = OpenAI(api_key=OPENAI_API_KEY)
|
| 16 |
|
| 17 |
+
|
| 18 |
def create_agent():
|
| 19 |
"""
|
| 20 |
Crea y retorna un Agent configurado para:
|
|
|
|
| 30 |
)
|
| 31 |
|
| 32 |
# 2) Obtenemos el WebSearchTool nativo:
|
| 33 |
+
web_search = get_search_tool(client)
|
| 34 |
|
| 35 |
# 3) Construimos el agente con instrucciones muy explícitas:
|
| 36 |
instrucciones = """
|