From 67e93f4b5bdaab5c884bbdba16ccc5712206bd54 Mon Sep 17 00:00:00 2001 From: David Yastremsky <58150256+dyastremsky@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:44:11 -0800 Subject: [PATCH] Add endpoint_type_map section to customizable frontend tutorial (#215) Improve wording --- genai-perf/docs/customizable_frontends.md | 16 +++++++++++++++- .../customizable_frontends_template | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/genai-perf/docs/customizable_frontends.md b/genai-perf/docs/customizable_frontends.md index 871b0550..737f7fcf 100644 --- a/genai-perf/docs/customizable_frontends.md +++ b/genai-perf/docs/customizable_frontends.md @@ -123,6 +123,20 @@ converters = { } ``` +## Map an Endpoint Type to the Output Format + +Open `genai_perf/parser.py`. +Add an mapping for your new endpoint type in the `_endpoint_type_map`. + +For example, see the code below. + +```python +_endpoint_type_map = { + # Existing mappings + "NEW-ENDPOINT": EndpointConfig("v1/endpoint", "openai", ic.OutputFormat.NEW_ENDPOINT), +} +``` + ## Update the Metrics Parser GenAI-Perf needs to know which metrics format your API uses. Go to @@ -142,7 +156,7 @@ After implementing your converter, you can run it against your server to ensure it works: ```bash -genai-perf profile -m TEST_MODEL --endpoint NEW-ENDPOINT +genai-perf profile -m TEST_MODEL --endpoint-type NEW-ENDPOINT ``` You can also write unit tests to ensure it works as expected. diff --git a/templates/genai-perf-templates/customizable_frontends_template b/templates/genai-perf-templates/customizable_frontends_template index 871b0550..737f7fcf 100644 --- a/templates/genai-perf-templates/customizable_frontends_template +++ b/templates/genai-perf-templates/customizable_frontends_template @@ -123,6 +123,20 @@ converters = { } ``` +## Map an Endpoint Type to the Output Format + +Open `genai_perf/parser.py`. +Add an mapping for your new endpoint type in the `_endpoint_type_map`. + +For example, see the code below. + +```python +_endpoint_type_map = { + # Existing mappings + "NEW-ENDPOINT": EndpointConfig("v1/endpoint", "openai", ic.OutputFormat.NEW_ENDPOINT), +} +``` + ## Update the Metrics Parser GenAI-Perf needs to know which metrics format your API uses. Go to @@ -142,7 +156,7 @@ After implementing your converter, you can run it against your server to ensure it works: ```bash -genai-perf profile -m TEST_MODEL --endpoint NEW-ENDPOINT +genai-perf profile -m TEST_MODEL --endpoint-type NEW-ENDPOINT ``` You can also write unit tests to ensure it works as expected.