Add projects
This commit is contained in:
parent
2d3a9ad623
commit
8b607dd700
1802 changed files with 503346 additions and 2 deletions
43
backend/sdk/translator/helpers.go
Normal file
43
backend/sdk/translator/helpers.go
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package translator
|
||||
|
||||
import "context"
|
||||
|
||||
// TranslateRequestByFormatName converts a request payload between schemas by their string identifiers.
|
||||
func TranslateRequestByFormatName(from, to Format, model string, rawJSON []byte, stream bool) []byte {
|
||||
return TranslateRequest(from, to, model, rawJSON, stream)
|
||||
}
|
||||
|
||||
// HasRequestTransformerByFormatName reports whether a request translator exists between two schemas.
|
||||
func HasRequestTransformerByFormatName(from, to Format) bool {
|
||||
return HasRequestTransformer(from, to)
|
||||
}
|
||||
|
||||
// HasResponseTransformerByFormatName reports whether a response translator exists between two schemas.
|
||||
func HasResponseTransformerByFormatName(from, to Format) bool {
|
||||
return HasResponseTransformer(from, to)
|
||||
}
|
||||
|
||||
// HasStreamResponseTransformerByFormatName reports whether a stream response translator exists between two schemas.
|
||||
func HasStreamResponseTransformerByFormatName(from, to Format) bool {
|
||||
return HasStreamResponseTransformer(from, to)
|
||||
}
|
||||
|
||||
// HasNonStreamResponseTransformerByFormatName reports whether a non-stream response translator exists between two schemas.
|
||||
func HasNonStreamResponseTransformerByFormatName(from, to Format) bool {
|
||||
return HasNonStreamResponseTransformer(from, to)
|
||||
}
|
||||
|
||||
// TranslateStreamByFormatName converts streaming responses between schemas by their string identifiers.
|
||||
func TranslateStreamByFormatName(ctx context.Context, from, to Format, model string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, param *any) [][]byte {
|
||||
return TranslateStream(ctx, from, to, model, originalRequestRawJSON, requestRawJSON, rawJSON, param)
|
||||
}
|
||||
|
||||
// TranslateNonStreamByFormatName converts non-streaming responses between schemas by their string identifiers.
|
||||
func TranslateNonStreamByFormatName(ctx context.Context, from, to Format, model string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, param *any) []byte {
|
||||
return TranslateNonStream(ctx, from, to, model, originalRequestRawJSON, requestRawJSON, rawJSON, param)
|
||||
}
|
||||
|
||||
// TranslateTokenCountByFormatName converts token counts between schemas by their string identifiers.
|
||||
func TranslateTokenCountByFormatName(ctx context.Context, from, to Format, count int64, rawJSON []byte) []byte {
|
||||
return TranslateTokenCount(ctx, from, to, count, rawJSON)
|
||||
}
|
||||
Loading…
Reference in a new issue