fixes regression in anthropic text > anthropic chat api translation
This commit is contained in:
@@ -81,7 +81,8 @@ export const handleStreamedResponse: RawResponseBodyHandler = async (
|
||||
// Transformer converts server-sent events from one vendor's API message
|
||||
// format to another.
|
||||
const transformer = new SSEMessageTransformer({
|
||||
inputFormat: req.outboundApi,
|
||||
inputFormat: req.outboundApi, // The format of the upstream service's events
|
||||
outputFormat: req.inboundApi, // The format the client requested
|
||||
inputApiVersion: String(req.headers["anthropic-version"]),
|
||||
logger: req.log,
|
||||
requestId: String(req.id),
|
||||
|
||||
@@ -20,6 +20,7 @@ type SSEMessageTransformerOptions = TransformOptions & {
|
||||
requestId: string;
|
||||
inputFormat: APIFormat;
|
||||
inputApiVersion?: string;
|
||||
outputFormat?: APIFormat;
|
||||
logger: typeof logger;
|
||||
};
|
||||
|
||||
@@ -47,7 +48,8 @@ export class SSEMessageTransformer extends Transform {
|
||||
this.msgCount = 0;
|
||||
this.transformFn = getTransformer(
|
||||
options.inputFormat,
|
||||
options.inputApiVersion
|
||||
options.inputApiVersion,
|
||||
options.outputFormat
|
||||
);
|
||||
this.inputFormat = options.inputFormat;
|
||||
this.fallbackId = options.requestId;
|
||||
|
||||
Reference in New Issue
Block a user