Conversation
Dependency ReviewThe following issues were found:
License Issuessettings.gradle
OpenSSF Scorecard
Scanned Files
|
Dependency ReviewThe following issues were found:
License Issuessettings.gradle
OpenSSF Scorecard
Scanned Files
|
Dependency ReviewThe following issues were found:
License Issuessettings.gradle
OpenSSF Scorecard
Scanned Files
|
Dependency ReviewThe following issues were found:
License Issuessettings.gradle
OpenSSF Scorecard
Scanned Files
|
Dependency ReviewThe following issues were found:
License Issuessettings.gradle
OpenSSF Scorecard
Scanned Files
|
|
|
||
| Buffer requestBody = context.getRequestBody(); | ||
| proxyRequest.putHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(requestBody.length())); | ||
| context.getRequestHeaders().forEach(proxyRequest::putHeader); |
There was a problem hiding this comment.
why did you remove the line?
There was a problem hiding this comment.
It didn't do anything. I removed the field.
| if (!Strings.CI.contains(contentType, Proxy.HEADER_CONTENT_TYPE_APPLICATION_JSON)) { | ||
| return respond(HttpStatus.UNSUPPORTED_MEDIA_TYPE, "Only application/json is supported"); | ||
| } | ||
| return proxy.getTaskExecutor().submit(() -> { |
There was a problem hiding this comment.
you don't need to run the block asynchronously.
| context.getRequest().body() | ||
| .compose(body -> { | ||
| log.info("Received body from client. Length: {}", body.length()); | ||
| return proxy.getTaskExecutor().submit(() -> parseBody(body)); |
|
|
||
| private void sendRequest() { | ||
| UpstreamRoute route = context.getUpstreamRoute(); | ||
| try { |
There was a problem hiding this comment.
the block should be in a separate method.
| Buffer responseBody = context.getResponseStream().getContent(); | ||
| context.setResponseBody(responseBody); | ||
| context.setResponseBodyTimestamp(System.currentTimeMillis()); | ||
| Future<TokenUsage> tokenUsageFuture = collectTokenUsage(responseBody); |
There was a problem hiding this comment.
I'm not sure the method supports collecting token usage for responses API
There was a problem hiding this comment.
It does. At least structurally, the usage section is similar and contains information that was previously available. I’ve updated the aliases to pick up the new field names.
https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response_usage%20%3E%20(schema)
| if (result.failed()) { | ||
| log.warn("Failed to collect token usage", result.cause()); | ||
| } | ||
| return collectResponseAttachments(responseBody); |
There was a problem hiding this comment.
the same thing for collecting attachments from responseAPI response
| context.getResponse().reset(); // drop connection, so that partial client response won't seem complete | ||
| log.warn("Can't send response to client. Error:", error); | ||
| Deployment deployment = context.getDeployment(); | ||
| if (deployment instanceof Model) { |
There was a problem hiding this comment.
This block should be revised for response API because it's tied to collecting token usage.
| public enum RouteTemplate { | ||
|
|
||
| // OpenAI API routes | ||
| RESPONSES( |
There was a problem hiding this comment.
I would rename to something meaningful at least LLM_RESPONSES_API
response is vague.
| .map(apiKeyData -> new AuthorizationResult(apiKeyData, null)); | ||
| } | ||
|
|
||
| if (apiKey == null && authorization.startsWith("Bearer ")) { |
There was a problem hiding this comment.
That may break authN flow for another IdP like Google. They send an opaque token instead of JWT.
| return new ProxyContext(proxy, config, request, newApiKeyData, extractedClaims, traceId, spanId, traceFlags); | ||
| } | ||
|
|
||
| public Future<HttpClientRequest> createProxyRequest(Function<Deployment, String> endpointSelector) { |
There was a problem hiding this comment.
I would move to BaseDeploymentController instead of making them available for any controller.
Dependency ReviewThe following issues were found:
License Issuessettings.gradle
OpenSSF Scorecard
Scanned Files
|
Dependency ReviewThe following issues were found:
License Issuessettings.gradle
OpenSSF Scorecard
Scanned Files
|
Dependency ReviewThe following issues were found:
License Issuessettings.gradle
OpenSSF Scorecard
Scanned Files
|
Initial support for Responses API.