-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart.py
More file actions
27 lines (21 loc) · 856 Bytes
/
Copy pathquickstart.py
File metadata and controls
27 lines (21 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""End-to-end quickstart for the Latence TRACE SDK."""
from __future__ import annotations
from latence import Latence
def main() -> None:
with Latence(
base_url="https://api.latence.ai",
) as client:
result = client.grounding.rag(
query="When was Newton born?",
response_text="Newton was born in 1643.",
raw_context=(
"Sir Isaac Newton (25 December 1642 – 20 March 1726/27 OS) "
"was an English mathematician, physicist, astronomer, alchemist..."
),
)
print("risk_band =", result.risk_band.value)
print("groundedness_v2 =", result.scores.groundedness_v2)
print("coverage_score =", result.scores.coverage_score_u)
print("request_id =", result.request_id)
if __name__ == "__main__":
main()