diff --git a/CHANGELOG.md b/CHANGELOG.md index 6094144..063ed32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 > **Note**: odd version numbers, for example, `0.13.0`, are not included in this changelog. They are used to test the new features and fixes before the final release. -## [0.23.4] - Unreleased +## [0.23.5] - Unreleased ### Added: - Support for using Dev Proxy Beta with commands - Command: `dev-proxy-toolkit.discover-urls-to-watch` - Start Dev Proxy in discovery mode +- Snippets: Added `devproxy-plugin-openai-telemetry` - OpenAITelemetryPlugin instance +- Snippets: Added `devproxy-plugin-openai-telemetry-config` - OpenAITelemetryPlugin config section +- Snippets: Added `devproxy-plugin-prices-file` - OpenAITelemetryPlugin telemetry prices file +- Snippets: Added `devproxy-plugin-price` - OpenAITelemetryPlugin telemetry model price ### Changed: diff --git a/README.md b/README.md index 7bc4c01..e6cd018 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ Shown when the active document is a Dev Proxy configuration file ### Snippets +| Prefix | Description | +| ------ | ----------- | | Prefix | Description | | ------ | ----------- | | `devproxy-config-file` | Dev Proxy config file | @@ -78,6 +80,8 @@ Shown when the active document is a Dev Proxy configuration file | `devproxy-mocks-file` | Dev Proxy mocks file | | `devproxy-mocks-file-schema` | Dev Proxy mocks file schema | | `devproxy-mock` | Dev Proxy mock | +| `devproxy-prices-file` | Dev Proxy prices file | +| `devproxy-price` | Dev Proxy price | | `devproxy-request` | Dev Proxy request | | `devproxy-response` | Dev Proxy response | | `devproxy-response-header` | Dev Proxy response header | @@ -139,6 +143,8 @@ Shown when the active document is a Dev Proxy configuration file | `devproxy-plugin-odata-paging-guidance` | ODataPagingGuidancePlugin instance | | `devproxy-plugin-graph-odsp-search-guidance` | ODSPSearchGuidancePlugin instance | | `devproxy-plugin-openai-mock-response` | OpenAIMockResponsePlugin instance | +| `devproxy-plugin-openai-telemetry` | OpenAITelemetryPlugin instance | +| `devproxy-plugin-openai-telemetry-config` | OpenAITelemetryPlugin config section | | `devproxy-plugin-open-api-spec-generator` | OpenApiSpecGeneratorPlugin instance | | `devproxy-plugin-open-api-spec-generator-config` | OpenApiSpecGeneratorPlugin config section | | `devproxy-plugin-rate-limiting` | MockResponsePlugin instance | diff --git a/package-lock.json b/package-lock.json index b6c50d8..36392d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dev-proxy-toolkit", - "version": "0.23.4", + "version": "0.23.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dev-proxy-toolkit", - "version": "0.23.4", + "version": "0.23.5", "dependencies": { "json-to-ast": "^2.1.0" }, diff --git a/package.json b/package.json index 2ed9e6c..5839286 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "dev-proxy-toolkit", "displayName": "Dev Proxy Toolkit", "description": "Makes it easy to create and update Dev Proxy configuration files.", - "version": "0.23.4", + "version": "0.23.5", "publisher": "garrytrinder", "engines": { "vscode": "^1.89.0" diff --git a/src/constants.ts b/src/constants.ts index b6243f1..393fc32 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -165,6 +165,13 @@ export const pluginSnippets: PluginSnippets = { OpenAIMockResponsePlugin: { instance: 'devproxy-plugin-openai-mock-response', }, + OpenAITelemetryPlugin: { + instance: 'devproxy-plugin-openai-telemetry', + config: { + name: 'devproxy-plugin-openai-telemetry-config', + required: true, + } + }, OpenApiSpecGeneratorPlugin: { instance: 'devproxy-plugin-open-api-spec-generator', config: { @@ -323,6 +330,10 @@ export const pluginDocs: PluginDocs = { name: 'OpenAI Mock Response Plugin', url: 'https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/openaimockresponseplugin', }, + OpenAITelemetryPlugin: { + name: 'OpenAI Telemetry Plugin', + url: 'https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/openaitelemetryplugin', + }, OpenApiSpecGeneratorPlugin: { name: 'Open API Spec Generator Plugin', url: 'https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/openapispecgeneratorplugin', diff --git a/src/snippets.json b/src/snippets.json index 05f2eb6..3d73577 100644 --- a/src/snippets.json +++ b/src/snippets.json @@ -71,6 +71,28 @@ ], "description": "Dev Proxy mock" }, + "PricesFile": { + "prefix": "devproxy-prices-file", + "body": [ + "{", + "\t\"\\$schema\": \"https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.28.0/openaitelemetryplugin.pricesfile.schema.json\",", + "\t\"prices\": {", + "\t\t$1", + "\t}", + "}" + ], + "description": "Dev Proxy prices file" + }, + "Price": { + "prefix": "devproxy-price", + "body": [ + "\"gpt-4\": {", + "\t\"input\": 0.03,", + "\t\"output\": 0.06", + "}" + ], + "description": "Dev Proxy price" + }, "Request": { "prefix": "devproxy-request", "body": [ @@ -855,6 +877,30 @@ ], "description": "OpenAIMockResponsePlugin instance" }, + "OpenAITelemetryPlugin": { + "prefix": "devproxy-plugin-openai-telemetry", + "body": [ + "{", + "\t\"name\": \"OpenAITelemetryPlugin\",", + "\t\"enabled\": true,", + "\t\"pluginPath\": \"~appFolder/plugins/dev-proxy-plugins.dll\",", + "\t\"configSection\": \"openAITelemetryPlugin\"", + "}" + ], + "description": "OpenAITelemetryPlugin instance" + }, + "OpenAITelemetryPluginConfig": { + "prefix": "devproxy-plugin-openai-telemetry-config", + "body": [ + "\"openAITelemetryPlugin\": {", + "\t\"\\$schema\": \"https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.28.0/openaitelemetryplugin.schema.json\",", + "\t\"application\": \"My app\",", + "\t\"includeCosts\": true,", + "\t\"pricesFile\": \"prices.json\"", + "}" + ], + "description": "OpenAITelemetryPlugin config section" + }, "OpenApiSpecGeneratorPlugin": { "prefix": "devproxy-plugin-open-api-spec-generator", "body": [ diff --git a/src/test/examples/prices.json b/src/test/examples/prices.json new file mode 100644 index 0000000..e69de29