Skip to content

Commit 9bc8502

Browse files
committed
Update generate_openapi.py
1 parent 394552d commit 9bc8502

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scripts/generate_openapi.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -671,13 +671,13 @@ def generate_openapi_schema(evaluators: Dict[str, Any]) -> Dict[str, Any]:
671671
"x-codeSamples": [
672672
{
673673
"lang": "python",
674-
"label": "Python (offline)",
675-
"source": f'import langwatch\nevaluation = langwatch.evaluation.init("my-incredible-evaluation")\n\nfor index, row in evaluation.loop(df.iterrows()):\n def evaluate(index, row):\n # Your evaluation logic here\n \n evaluation.run(\n "{evaluator_id}",\n index=index,\n data={{\n{chr(10).join(f" \"{field}\": {field}," for field in evaluator.get("requiredFields", []) + evaluator.get("optionalFields", []))}\n }},\n settings={{\n \n }}\n )\n\n evaluation.submit(evaluate, index, row)',
674+
"label": "Offline Evaluation",
675+
"source": f'import langwatch\n\nevaluation = langwatch.evaluation.init("my-incredible-evaluation")\n\nfor index, row in evaluation.loop(df.iterrows()):\n \n evaluation.run(\n "{evaluator_id}",\n index=index,\n data={{\n{chr(10).join(f" \"{field}\": {field}," for field in evaluator.get("requiredFields", []) + evaluator.get("optionalFields", []))}\n }},\n settings={{}}\n )\n',
676676
},
677677
{
678678
"lang": "python",
679-
"label": "Python (online)",
680-
"source": f'import langwatch\n@langwatch.span()\ndef llm_step():\n ... # your existing code\n result = langwatch.get_current_span().evaluate(\n "{evaluator_id}",\n{chr(10).join(f" {field}=\"\", # required" for field in evaluator.get("requiredFields", []))}\n{chr(10).join(f" {field}=\"\", # optional" for field in evaluator.get("optionalFields", []))}\n settings={{}},\n )\n print(result)',
679+
"label": "Realtime Evaluation",
680+
"source": f'import langwatch\n\n@langwatch.span()\ndef llm_step():\n ... # your existing code\n result = langwatch.get_current_span().evaluate(\n "{evaluator_id}",\n data={{\n{chr(10).join([f" \"{field}\": \"\"," for field in evaluator.get("requiredFields", []) + evaluator.get("optionalFields", [])])}\n }},\n settings={{}},\n )\n print(result)',
681681
},
682682
{
683683
"lang": "typescript",
@@ -744,13 +744,13 @@ def generate_openapi_schema(evaluators: Dict[str, Any]) -> Dict[str, Any]:
744744
"x-codeSamples": [
745745
{
746746
"lang": "python",
747-
"label": "Python (offline)",
748-
"source": f'import langwatch\nevaluation = langwatch.evaluation.init("my-incredible-evaluation")\n\nfor index, row in evaluation.loop(df.iterrows()):\n def evaluate(index, row):\n # Your evaluation logic here\n \n evaluation.run(\n "{evaluator_id}",\n index=index,\n data={{\n{chr(10).join(f" \"{field}\": {field}," for field in evaluator.get("requiredFields", []) + evaluator.get("optionalFields", []))}\n }},\n settings={{\n \n }}\n )\n\n evaluation.submit(evaluate, index, row)',
747+
"label": "Offline Evaluation",
748+
"source": f'import langwatch\n\nevaluation = langwatch.evaluation.init("my-incredible-evaluation")\n\nfor index, row in evaluation.loop(df.iterrows()):\n \n evaluation.run(\n "{evaluator_id}",\n index=index,\n data={{\n{chr(10).join(f" \"{field}\": {field}," for field in evaluator.get("requiredFields", []) + evaluator.get("optionalFields", []))}\n }},\n settings={{}}\n )\n',
749749
},
750750
{
751751
"lang": "python",
752-
"label": "Python (online)",
753-
"source": f'import langwatch\n@langwatch.span()\ndef llm_step():\n ... # your existing code\n result = langwatch.get_current_span().evaluate(\n "{evaluator_id}",\n{chr(10).join(f" {field}=\"\", # required" for field in evaluator.get("requiredFields", []))}\n{chr(10).join(f" {field}=\"\", # optional" for field in evaluator.get("optionalFields", []))}\n settings={{}},\n )\n print(result)',
752+
"label": "Realtime Evaluation",
753+
"source": f'import langwatch\n\n@langwatch.span()\ndef llm_step():\n ... # your existing code\n result = langwatch.get_current_span().evaluate(\n "{evaluator_id}",\n data={{\n{chr(10).join([f" \"{field}\": \"\"," for field in evaluator.get("requiredFields", []) + evaluator.get("optionalFields", [])])}\n }},\n settings={{}},\n )\n print(result)',
754754
},
755755
{
756756
"lang": "typescript",

0 commit comments

Comments
 (0)