Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,26 +5,23 @@ import gradio as gr
|
|
| 5 |
from pydantic_ai import Agent
|
| 6 |
from pydantic_ai.mcp import MCPServerHTTP
|
| 7 |
from pydantic_ai.models.openai import OpenAIModel
|
| 8 |
-
from pydantic_ai.providers.
|
| 9 |
|
| 10 |
# MCP Server SSE URL
|
| 11 |
SSE_URL = "https://oppaai-job-search-mcp-server.hf.space/gradio_api/mcp/sse"
|
| 12 |
server = MCPServerHTTP(url=SSE_URL)
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
# Use
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
base_url="https://api-inference.huggingface.co/models/Qwen/Qwen3-30B-A3B",
|
| 21 |
-
token=HF_TOKEN,
|
| 22 |
-
),
|
| 23 |
)
|
| 24 |
|
| 25 |
# Create Agent with MCP Server
|
| 26 |
agent = Agent(
|
| 27 |
-
model=
|
| 28 |
mcp_servers=[server],
|
| 29 |
instructions="""
|
| 30 |
Your name is Jobcy. You are an AI assistant designed to help users to find remote jobs by searching through job listings from various sources, including the Jobicy API and other platforms.
|
|
|
|
| 5 |
from pydantic_ai import Agent
|
| 6 |
from pydantic_ai.mcp import MCPServerHTTP
|
| 7 |
from pydantic_ai.models.openai import OpenAIModel
|
| 8 |
+
from pydantic_ai.providers.openrouter import OpenRouterProvider
|
| 9 |
|
| 10 |
# MCP Server SSE URL
|
| 11 |
SSE_URL = "https://oppaai-job-search-mcp-server.hf.space/gradio_api/mcp/sse"
|
| 12 |
server = MCPServerHTTP(url=SSE_URL)
|
| 13 |
|
| 14 |
+
OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY") # Make sure your HF_TOKEN is set in environment variables
|
| 15 |
|
| 16 |
+
# Use OpenRouter hosted LLM Qwen3-30B-A3B model
|
| 17 |
+
model = OpenAIModel(
|
| 18 |
+
'qwen/qwen3-235b-a22b:free',
|
| 19 |
+
provider=OpenRouterProvider(api_key=OPENROUTER_API_KEY),
|
|
|
|
|
|
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
# Create Agent with MCP Server
|
| 23 |
agent = Agent(
|
| 24 |
+
model=model,
|
| 25 |
mcp_servers=[server],
|
| 26 |
instructions="""
|
| 27 |
Your name is Jobcy. You are an AI assistant designed to help users to find remote jobs by searching through job listings from various sources, including the Jobicy API and other platforms.
|