mirror of
https://github.com/hoshikawa2/agent_platform_oci.git
synced 2026-07-09 14:04:19 +00:00
First commit
This commit is contained in:
47
scripts/generate_rag_embeddings.py
Normal file
47
scripts/generate_rag_embeddings.py
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
FRAMEWORK_SRC = ROOT / "agent_framework" / "src"
|
||||
if str(FRAMEWORK_SRC) not in sys.path:
|
||||
sys.path.insert(0, str(FRAMEWORK_SRC))
|
||||
|
||||
from agent_framework.config.settings import get_settings
|
||||
from agent_framework.rag.ingest import ingest_documents_sync, parse_csv
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Generate RAG embeddings and store document chunks in the configured vector store."
|
||||
)
|
||||
parser.add_argument("--docs-dir", default=None, help="Directory containing Markdown/text/YAML/JSON documents.")
|
||||
parser.add_argument("--namespace", default=None, help="RAG namespace used by the agent profile.")
|
||||
parser.add_argument("--globs", default=None, help="Comma-separated file globs. Example: '*.md,*.txt'.")
|
||||
parser.add_argument("--chunk-size", type=int, default=None, help="Maximum chunk size in characters.")
|
||||
parser.add_argument("--chunk-overlap", type=int, default=None, help="Chunk overlap in characters.")
|
||||
args = parser.parse_args()
|
||||
|
||||
settings = get_settings()
|
||||
result = ingest_documents_sync(
|
||||
settings,
|
||||
docs_dir=args.docs_dir,
|
||||
namespace=args.namespace,
|
||||
file_globs=parse_csv(args.globs, []) or None,
|
||||
chunk_size=args.chunk_size,
|
||||
chunk_overlap=args.chunk_overlap,
|
||||
)
|
||||
|
||||
print("RAG embedding generation completed")
|
||||
print(f" namespace: {result.namespace}")
|
||||
print(f" files read: {result.files_read}")
|
||||
print(f" chunks created: {result.chunks_created}")
|
||||
print(f" documents saved:{result.documents_saved}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
4
scripts/run_ai_gateway.sh
Normal file
4
scripts/run_ai_gateway.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../apps/ai_gateway"
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 9100 --reload
|
||||
8
scripts/run_backend.sh
Normal file
8
scripts/run_backend.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../agent_template_backend"
|
||||
python -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -e ../agent_framework --no-build-isolation || pip install -e ../agent_framework
|
||||
pip install -r requirements.txt
|
||||
uvicorn app.main:app --reload --reload-dir app --reload-dir config --port 8000
|
||||
4
scripts/run_frontend.sh
Normal file
4
scripts/run_frontend.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../agent_frontend"
|
||||
python -m http.server 5173
|
||||
4
scripts/run_mcp_gateway.sh
Normal file
4
scripts/run_mcp_gateway.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../apps/mcp_gateway"
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 9200 --reload
|
||||
18
scripts/run_mcp_servers.sh
Normal file
18
scripts/run_mcp_servers.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
python -m venv "$ROOT/.venv"
|
||||
source "$ROOT/.venv/bin/activate"
|
||||
pip install -r "$ROOT/mcp_servers/telecom_mcp_server/requirements.txt"
|
||||
pip install -r "$ROOT/mcp_servers/retail_mcp_server/requirements.txt"
|
||||
|
||||
uvicorn --app-dir "$ROOT/mcp_servers/telecom_mcp_server" main:app --host 0.0.0.0 --port 8100 &
|
||||
PID1=$!
|
||||
uvicorn --app-dir "$ROOT/mcp_servers/retail_mcp_server" main:app --host 0.0.0.0 --port 8200 &
|
||||
PID2=$!
|
||||
|
||||
echo "Telecom MCP em http://localhost:8100"
|
||||
echo "Retail MCP em http://localhost:8200"
|
||||
trap 'kill $PID1 $PID2' INT TERM EXIT
|
||||
wait
|
||||
7
scripts/smoke_usage_test.sh
Normal file
7
scripts/smoke_usage_test.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
BASE_URL="${BASE_URL:-http://localhost:8000}"
|
||||
curl -s -X POST "$BASE_URL/gateway/message" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"channel":"web","payload":{"text":"teste smoke","user_id":"smoke-user","session_id":"smoke-session","message_id":"smoke-1"}}' | python -m json.tool
|
||||
curl -s "$BASE_URL/debug/usage" | python -m json.tool
|
||||
Reference in New Issue
Block a user