Repository navigation
Adds support for auth in generating TypeSpec. Closes #1148 - #1154
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds authentication support for TypeSpec generation while also fixing bugs in default config usage for Ollama, caching of LLM responses, and enhancing error logging. Key changes include:
- Trimming and properly assigning the trailing slash in LanguageModel URLs.
- Introducing auth support in TypeSpec by adding OAuth2Auth in the namespace and updating Operation serialization.
- Refactoring cache retrieval methods and adding error logging for both OpenAI and Ollama clients, as well as updating header matching in HTTP-related code.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| dev-proxy/CommandHandlers/ProxyCommandHandler.cs | Improved URL trimming for LanguageModel URLs. |
| dev-proxy-plugins/TypeSpec/Http.cs | Added auth support and updated header name conversion for parameters. |
| dev-proxy-plugins/TypeSpec/Auth.cs | Introduced new auth classes, including OAuth2Auth with alias writing. |
| dev-proxy-plugins/StringExtensions.cs | Added useful string extension methods. |
| dev-proxy-plugins/Http.cs | Updated header list for authentication matching. |
| dev-proxy-abstractions/LanguageModel/OpenAILanguageModelClient.cs | Refactored cache method and improved error logging for OpenAI client. |
| dev-proxy-abstractions/LanguageModel/OllamaLanguageModelClient.cs | Refactored cache method and improved error logging for Ollama client. |
Comments suppressed due to low confidence (1)
dev-proxy-plugins/Http.cs:237
- The removal of the 'api-key' header from the allowed headers may cause authentication issues since test requests use 'api-key'. Consider re-adding 'api-key' or updating tests and related documentation to reflect this change.
"apikey",
garrytrinder
approved these changes
Apr 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for auth in generating TypeSpec. Closes #1148
Also:
To test support for auth, you can use the following requests (access tokens are dummy so no security issues):