USER commited on
Commit
3e4abc0
·
0 Parent(s):

Initial commit for Hugging Face Space

Browse files
Files changed (3) hide show
  1. README.md +3 -0
  2. app.py +49 -0
  3. requirements.txt +96 -0
README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Airbnb LLM Agent (MCP + Llama4)
2
+
3
+ Ce Space est un assistant intelligent qui interroge Airbnb via MCP et Llama 4 pour trouver les meilleures offres selon vos critères.
app.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import asyncio
3
+ from textwrap import dedent
4
+ from agno.agent import Agent
5
+ from agno.models.groq import Groq
6
+ from agno.tools.mcp import MCPTools
7
+ from agno.tools.thinking import ThinkingTools
8
+ from dotenv import load_dotenv
9
+ import os
10
+
11
+ # Charger la clé API
12
+ load_dotenv()
13
+ GROQ_API_KEY = os.getenv("GROQ_API_KEY")
14
+ if not GROQ_API_KEY:
15
+ raise ValueError("Veuillez définir la variable GROQ_API_KEY.")
16
+ os.environ["GROQ_API_KEY"] = GROQ_API_KEY
17
+
18
+
19
+ # Fonction async appelée par Gradio
20
+ async def search_airbnb(query: str) -> str:
21
+ async with MCPTools("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt") as mcp_tools:
22
+ agent = Agent(
23
+ model=Groq(id="meta-llama/llama-4-scout-17b-16e-instruct"),
24
+ tools=[ThinkingTools(), mcp_tools],
25
+ instructions=dedent("""
26
+ ## Instructions générales
27
+ - Utilise l'outil 'think' pour planifier les étapes.
28
+ - Présente 10 annonces Airbnb sous forme de tableau avec liens.
29
+ - Valide les résultats avant de répondre à l'utilisateur.
30
+ """),
31
+ add_datetime_to_instructions=True,
32
+ show_tool_calls=False,
33
+ markdown=True,
34
+ )
35
+ result = await agent.arun(query)
36
+ return result.content
37
+
38
+
39
+ # Interface Gradio qui supporte nativement async
40
+ demo = gr.Interface(
41
+ fn=search_airbnb,
42
+ inputs=gr.Textbox(label="Votre requête", lines=4, placeholder="Ex: logement 1 chambre à Paris du 5 au 15 août..."),
43
+ outputs=gr.Markdown(label="Résultat"),
44
+ title="🏠 Agent Airbnb intelligent (MCP + Llama 4)",
45
+ description="Un assistant LLM intelligent pour chercher les meilleures annonces Airbnb selon vos critères.",
46
+ )
47
+
48
+ if __name__ == "__main__":
49
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ agno==1.5.3
2
+ aiofiles==24.1.0
3
+ annotated-types==0.7.0
4
+ anyio==4.9.0
5
+ asttokens==3.0.0
6
+ audioop-lts==0.2.1
7
+ certifi==2025.4.26
8
+ charset-normalizer==3.4.2
9
+ click==8.1.8
10
+ comm==0.2.2
11
+ debugpy==1.8.14
12
+ decorator==5.2.1
13
+ distro==1.9.0
14
+ docstring_parser==0.16
15
+ executing==2.2.0
16
+ fastapi==0.115.12
17
+ ffmpy==0.5.0
18
+ filelock==3.18.0
19
+ fsspec==2025.3.2
20
+ gitdb==4.0.12
21
+ GitPython==3.1.44
22
+ gradio==5.31.0
23
+ gradio_client==1.10.1
24
+ groovy==0.1.2
25
+ groq==0.25.0
26
+ h11==0.16.0
27
+ httpcore==1.0.9
28
+ httpx==0.28.1
29
+ httpx-sse==0.4.0
30
+ huggingface-hub==0.31.2
31
+ idna==3.10
32
+ ipykernel==6.29.5
33
+ ipython==9.2.0
34
+ ipython_pygments_lexers==1.1.1
35
+ jedi==0.19.2
36
+ Jinja2==3.1.6
37
+ jsonref==1.1.0
38
+ jupyter_client==8.6.3
39
+ jupyter_core==5.7.2
40
+ markdown-it-py==3.0.0
41
+ MarkupSafe==3.0.2
42
+ matplotlib-inline==0.1.7
43
+ mcp==1.9.0
44
+ mcpadapt==0.1.5
45
+ mdurl==0.1.2
46
+ nest-asyncio==1.6.0
47
+ numpy==2.2.5
48
+ orjson==3.10.18
49
+ packaging==25.0
50
+ pandas==2.2.3
51
+ parso==0.8.4
52
+ pexpect==4.9.0
53
+ pillow==11.2.1
54
+ platformdirs==4.3.8
55
+ prompt_toolkit==3.0.51
56
+ psutil==7.0.0
57
+ ptyprocess==0.7.0
58
+ pure_eval==0.2.3
59
+ pydantic==2.11.4
60
+ pydantic-settings==2.9.1
61
+ pydantic_core==2.33.2
62
+ pydub==0.25.1
63
+ Pygments==2.19.1
64
+ python-dateutil==2.9.0.post0
65
+ python-dotenv==1.1.0
66
+ python-multipart==0.0.20
67
+ pytz==2025.2
68
+ PyYAML==6.0.2
69
+ pyzmq==26.4.0
70
+ requests==2.32.3
71
+ rich==14.0.0
72
+ ruff==0.11.10
73
+ safehttpx==0.1.6
74
+ semantic-version==2.10.0
75
+ shellingham==1.5.4
76
+ six==1.17.0
77
+ smmap==5.0.2
78
+ smolagents==1.16.1
79
+ sniffio==1.3.1
80
+ sse-starlette==2.3.5
81
+ stack-data==0.6.3
82
+ starlette==0.46.2
83
+ tomli==2.2.1
84
+ tomlkit==0.13.2
85
+ tornado==6.5
86
+ tqdm==4.67.1
87
+ traitlets==5.14.3
88
+ typer==0.15.4
89
+ typing-inspection==0.4.0
90
+ typing_extensions==4.13.2
91
+ tzdata==2025.2
92
+ urllib3==2.4.0
93
+ uv==0.7.5
94
+ uvicorn==0.34.2
95
+ wcwidth==0.2.13
96
+ websockets==15.0.1