Spaces:
Runtime error
Runtime error
wip run using API env vars
Browse files- .gitignore +8 -0
- README.md +13 -0
- app.py +29 -0
- requirements.dev.txt +1 -0
- retriever.py +1 -1
.gitignore
CHANGED
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Byte-compiled / optimized / DLL files
|
2 |
__pycache__/
|
3 |
*.py[codz]
|
|
|
1 |
+
# omit IDE configs
|
2 |
+
.vscode/settings.json
|
3 |
+
|
4 |
+
# OS clutter
|
5 |
+
**/.DS_Store
|
6 |
+
**/Thumbs.db
|
7 |
+
|
8 |
+
|
9 |
# Byte-compiled / optimized / DLL files
|
10 |
__pycache__/
|
11 |
*.py[codz]
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Unit3AgenticRAG
|
3 |
+
emoji: 🌖
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: green
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 5.35.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Application File"""
|
2 |
+
|
3 |
+
import os
|
4 |
+
|
5 |
+
from smolagents import GradioUI, CodeAgent, InferenceClientModel
|
6 |
+
|
7 |
+
from retriever import load_guest_dataset
|
8 |
+
|
9 |
+
OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
|
10 |
+
BASE_URL = os.environ["BASE_URL"]
|
11 |
+
|
12 |
+
|
13 |
+
model = InferenceClientModel(api_key=OPENAI_API_KEY, base_url=BASE_URL)
|
14 |
+
|
15 |
+
|
16 |
+
# Load the guest dataset and initialize the guest info tool
|
17 |
+
guest_info_tool = load_guest_dataset()
|
18 |
+
|
19 |
+
# Create Alfred with all the tools
|
20 |
+
alfred = CodeAgent(
|
21 |
+
tools=[guest_info_tool],
|
22 |
+
model=model,
|
23 |
+
add_base_tools=True, # Add any additional base tools
|
24 |
+
planning_interval=3, # Enable planning every 3 steps
|
25 |
+
)
|
26 |
+
|
27 |
+
|
28 |
+
if __name__ == "__main__":
|
29 |
+
GradioUI(alfred).launch()
|
requirements.dev.txt
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
-r requirements.txt
|
2 |
black
|
|
|
3 |
pylint
|
4 |
pytest
|
5 |
wheel
|
|
|
1 |
-r requirements.txt
|
2 |
black
|
3 |
+
gradio
|
4 |
pylint
|
5 |
pytest
|
6 |
wheel
|
retriever.py
CHANGED
@@ -65,7 +65,7 @@ def load_guest_dataset():
|
|
65 |
page_content="\n".join(
|
66 |
[
|
67 |
f"Name: {guest[NAME]}",
|
68 |
-
f"Relation: {guest[RELATION]",
|
69 |
f"Description: {guest[DESCRIPTION]}",
|
70 |
f"Email: {guest[EMAIL]}",
|
71 |
]
|
|
|
65 |
page_content="\n".join(
|
66 |
[
|
67 |
f"Name: {guest[NAME]}",
|
68 |
+
f"Relation: {guest[RELATION]}",
|
69 |
f"Description: {guest[DESCRIPTION]}",
|
70 |
f"Email: {guest[EMAIL]}",
|
71 |
]
|