Package org.mockserver.llm.codec
Class BedrockCodec
- java.lang.Object
-
- org.mockserver.llm.codec.BedrockCodec
-
- All Implemented Interfaces:
ProviderCodec
public class BedrockCodec extends Object implements ProviderCodec
Codec for AWS Bedrock (Anthropic-on-Bedrock) invokeModel API (version bedrock-2023-05-31).This codec targets the plain Anthropic body wire format used by Bedrock's
invokeModelendpoint for Anthropic Claude models. The request and response shapes are essentially identical to native Anthropic Messages API — the key difference is the model identifier format and URL path.Limitation: Bedrock's
InvokeModelWithResponseStreamwraps each SSE chunk in a binary{"chunk":{"bytes":"..."}}envelope. This codec does not implement that binary chunk-wrapping framing, emitting instead the plain Anthropic SSE event stream. This is sufficient for most testing scenarios where the Bedrock SDK is configured to auto-decode the envelope, or where tests mock at the HTTP layer after SDK decoding.
-
-
Constructor Summary
Constructors Constructor Description BedrockCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringapiVersion()ParsedConversationdecode(HttpRequest request)HttpResponseencode(Completion completion, String model)HttpResponseencodeEmbedding(EmbeddingResponse embedding, String input)List<SseEvent>encodeStreaming(Completion completion, String model, StreamingPhysics physics)Providerprovider()
-
-
-
Method Detail
-
provider
public Provider provider()
- Specified by:
providerin interfaceProviderCodec
-
apiVersion
public String apiVersion()
- Specified by:
apiVersionin interfaceProviderCodec
-
encode
public HttpResponse encode(Completion completion, String model)
- Specified by:
encodein interfaceProviderCodec
-
encodeStreaming
public List<SseEvent> encodeStreaming(Completion completion, String model, StreamingPhysics physics)
- Specified by:
encodeStreamingin interfaceProviderCodec
-
decode
public ParsedConversation decode(HttpRequest request)
- Specified by:
decodein interfaceProviderCodec
-
encodeEmbedding
public HttpResponse encodeEmbedding(EmbeddingResponse embedding, String input)
- Specified by:
encodeEmbeddingin interfaceProviderCodec
-
-