Spaces:
Runtime error
Runtime error
Commit ·
83fc25d
1
Parent(s): 1315e90
simplif file structure
Browse files- app/agents/claims.py +2 -2
- app/agents/retriever.py +1 -1
- app/agents/summarizer.py +2 -2
- app/agents/verifier.py +2 -2
- app/{utils → core}/auth.py +0 -0
- app/core/ibm_sanity.py +1 -1
- app/core/orchestrator.py +1 -0
- app/{utils → core}/parse_json.py +0 -0
app/agents/claims.py
CHANGED
|
@@ -4,9 +4,9 @@ import os, json, re, time, requests
|
|
| 4 |
from typing import Dict, Any, List
|
| 5 |
|
| 6 |
from app.core.config import WATSONX_BASE_URL, WATSONX_PROJECT, IBM_CLAIM_MODEL_ID
|
| 7 |
-
from app.
|
| 8 |
from app.schemas.claim import Claim
|
| 9 |
-
from app.
|
| 10 |
|
| 11 |
GEN_URL = f"{WATSONX_BASE_URL.rstrip('/')}/ml/v1/text/generation?version=2023-05-29"
|
| 12 |
|
|
|
|
| 4 |
from typing import Dict, Any, List
|
| 5 |
|
| 6 |
from app.core.config import WATSONX_BASE_URL, WATSONX_PROJECT, IBM_CLAIM_MODEL_ID
|
| 7 |
+
from app.core.auth import get_ibm_iam_token
|
| 8 |
from app.schemas.claim import Claim
|
| 9 |
+
from app.core.parse_json import parse_json_anywhere
|
| 10 |
|
| 11 |
GEN_URL = f"{WATSONX_BASE_URL.rstrip('/')}/ml/v1/text/generation?version=2023-05-29"
|
| 12 |
|
app/agents/retriever.py
CHANGED
|
@@ -5,7 +5,7 @@ import os, json, numpy as np, faiss, requests
|
|
| 5 |
from app.schemas.claim import Claim
|
| 6 |
from app.schemas.evidence import Evidence
|
| 7 |
from app.core.config import WATSONX_BASE_URL as BASE, WATSONX_PROJECT as PROJECT_ID, WATSONX_API_KEY as APIKEY, IBM_EMBEDDINGS_MODEL_ID as EMB_MODEL_ID, IBM_RERANK_MODEL_ID as RERANK_MODEL_ID, IBM_API_VERSION as VERSION, IBM_EMBEDDINGS_MODEL_ID as EMB_MODEL_ID, IBM_RERANK_MODEL_ID as RERANK_MODEL_ID, WATSONX_API_KEY as API_KEY
|
| 8 |
-
from app.
|
| 9 |
|
| 10 |
BASE_URL = (BASE or "").rstrip("/")
|
| 11 |
IDX_DIR = "kb/index"
|
|
|
|
| 5 |
from app.schemas.claim import Claim
|
| 6 |
from app.schemas.evidence import Evidence
|
| 7 |
from app.core.config import WATSONX_BASE_URL as BASE, WATSONX_PROJECT as PROJECT_ID, WATSONX_API_KEY as APIKEY, IBM_EMBEDDINGS_MODEL_ID as EMB_MODEL_ID, IBM_RERANK_MODEL_ID as RERANK_MODEL_ID, IBM_API_VERSION as VERSION, IBM_EMBEDDINGS_MODEL_ID as EMB_MODEL_ID, IBM_RERANK_MODEL_ID as RERANK_MODEL_ID, WATSONX_API_KEY as API_KEY
|
| 8 |
+
from app.core.auth import get_ibm_iam_token
|
| 9 |
|
| 10 |
BASE_URL = (BASE or "").rstrip("/")
|
| 11 |
IDX_DIR = "kb/index"
|
app/agents/summarizer.py
CHANGED
|
@@ -13,8 +13,8 @@ from app.core.config import (
|
|
| 13 |
IBM_SUMMARY_MODEL_ID as MODEL_ID,
|
| 14 |
IBM_API_VERSION,
|
| 15 |
)
|
| 16 |
-
from app.
|
| 17 |
-
from app.
|
| 18 |
|
| 19 |
|
| 20 |
# -------- Helpers --------
|
|
|
|
| 13 |
IBM_SUMMARY_MODEL_ID as MODEL_ID,
|
| 14 |
IBM_API_VERSION,
|
| 15 |
)
|
| 16 |
+
from app.core.auth import get_ibm_iam_token
|
| 17 |
+
from app.core.parse_json import parse_json_anywhere
|
| 18 |
|
| 19 |
|
| 20 |
# -------- Helpers --------
|
app/agents/verifier.py
CHANGED
|
@@ -7,8 +7,8 @@ from app.schemas.claim import Claim
|
|
| 7 |
from app.schemas.evidence import Evidence
|
| 8 |
from app.schemas.verdict import Verdict
|
| 9 |
from app.core.config import WATSONX_BASE_URL, WATSONX_PROJECT, IBM_VERIFIER_MODEL_ID, IBM_API_VERSION
|
| 10 |
-
from app.
|
| 11 |
-
from app.
|
| 12 |
|
| 13 |
PROMPT = """You are a precise fact verifier.
|
| 14 |
Return STRICT JSON ONLY. Your first character MUST be '{' and your last character MUST be '}'.
|
|
|
|
| 7 |
from app.schemas.evidence import Evidence
|
| 8 |
from app.schemas.verdict import Verdict
|
| 9 |
from app.core.config import WATSONX_BASE_URL, WATSONX_PROJECT, IBM_VERIFIER_MODEL_ID, IBM_API_VERSION
|
| 10 |
+
from app.core.auth import get_ibm_iam_token
|
| 11 |
+
from app.core.parse_json import parse_json_anywhere
|
| 12 |
|
| 13 |
PROMPT = """You are a precise fact verifier.
|
| 14 |
Return STRICT JSON ONLY. Your first character MUST be '{' and your last character MUST be '}'.
|
app/{utils → core}/auth.py
RENAMED
|
File without changes
|
app/core/ibm_sanity.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# app/core/ibm_sanity.py
|
| 2 |
import os, requests, json, numpy as np
|
| 3 |
from app.core.config import WATSONX_BASE_URL, WATSONX_PROJECT, WATSONX_API_KEY
|
| 4 |
-
from app.
|
| 5 |
|
| 6 |
VERSION = os.getenv("IBM_API_VERSION", "2023-05-29")
|
| 7 |
EMB = os.getenv("IBM_EMBEDDINGS_MODEL_ID", "")
|
|
|
|
| 1 |
# app/core/ibm_sanity.py
|
| 2 |
import os, requests, json, numpy as np
|
| 3 |
from app.core.config import WATSONX_BASE_URL, WATSONX_PROJECT, WATSONX_API_KEY
|
| 4 |
+
from app.core.auth import get_ibm_iam_token
|
| 5 |
|
| 6 |
VERSION = os.getenv("IBM_API_VERSION", "2023-05-29")
|
| 7 |
EMB = os.getenv("IBM_EMBEDDINGS_MODEL_ID", "")
|
app/core/orchestrator.py
CHANGED
|
@@ -10,6 +10,7 @@ from app.agents.retriever import retrieve_evidence_for_claims
|
|
| 10 |
from app.agents.verifier import verify
|
| 11 |
from app.agents.summarizer import make_report
|
| 12 |
import os
|
|
|
|
| 13 |
os.environ.setdefault("KMP_DUPLICATE_LIB_OK", "TRUE")
|
| 14 |
os.environ.setdefault("OMP_NUM_THREADS", "1")
|
| 15 |
|
|
|
|
| 10 |
from app.agents.verifier import verify
|
| 11 |
from app.agents.summarizer import make_report
|
| 12 |
import os
|
| 13 |
+
|
| 14 |
os.environ.setdefault("KMP_DUPLICATE_LIB_OK", "TRUE")
|
| 15 |
os.environ.setdefault("OMP_NUM_THREADS", "1")
|
| 16 |
|
app/{utils → core}/parse_json.py
RENAMED
|
File without changes
|