Skip to content

Commit

Permalink
Add endpoint_type_map section to customizable frontend tutorial (#215)
Browse files Browse the repository at this point in the history
Improve wording
  • Loading branch information
dyastremsky authored Dec 10, 2024
1 parent b13e65c commit 67e93f4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
16 changes: 15 additions & 1 deletion genai-perf/docs/customizable_frontends.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
16 changes: 15 additions & 1 deletion templates/genai-perf-templates/customizable_frontends_template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit 67e93f4

Please sign in to comment.