EvaluatorModel.predict:v4
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
import weave
import httpx
import json
@weave.op()
async def get_answer(question: str, application: str = "api-eval") -> str:
url = "http://0.0.0.0:8000/chat/query"
payload = {
"question": question,
"application": application,
"language": "en",
}
async with httpx.AsyncClient(timeout=200.0) as client:
response = await client.post(url, json=payload)
response_json = response.json()
return json.dumps(response_json)
@weave.op()
async def get_eval_record(
question: str,
) -> dict:
response = await get_answer(question, application="1.2-eval_8ec557e")
response = json.loads(response)
return {
"system_prompt": response["system_prompt"],