MCPcopy Create free account

hub / github.com/aws-samples/bedrock-access-gateway / functions

Functions48 in github.com/aws-samples/bedrock-access-gateway

↓ 7 callersMethod_resolve_to_foundation_model
Resolve any model identifier to foundation model ID for feature detection. Handles: - Cross-region profiles (us.*, eu.*, apa
src/api/models/bedrock.py:253
↓ 4 callersMethod_create_response
( self, model: str, message_id: str, content: list[dict] | None = None,
src/api/models/bedrock.py:912
↓ 4 callersMethodstream_response_to_bytes
(response: ChatStreamResponse | Error | None = None)
src/api/models/base.py:50
↓ 3 callersMethod_invoke_model
(self, args: dict, model_id: str)
src/api/models/bedrock.py:1288
↓ 2 callersMethod_convert_finish_reason
Below is a list of finish reason according to OpenAI doc: - stop: if the model hit a natural stop point or a provided stop sequence,
src/api/models/bedrock.py:1259
↓ 2 callersMethod_invoke_bedrock
Common logic for invoke bedrock models
src/api/models/bedrock.py:335
↓ 2 callersMethod_parse_content_parts
( self, message: UserMessage | AssistantMessage, model_id: str, )
src/api/models/bedrock.py:1187
↓ 2 callersMethod_supports_prompt_caching
Check if model supports prompt caching based on model ID pattern. Uses pattern matching instead of hardcoded whitelist for better ma
src/api/models/bedrock.py:275
↓ 2 callersMethodgenerate_message_id
()
src/api/models/base.py:46
↓ 2 callersFunctionlist_bedrock_models
Automatically getting a list of supported models. Returns a model list combines: - ON_DEMAND models. - Cross-Region Inference Pro
src/api/models/bedrock.py:111
↓ 2 callersMethodlist_models
Return a list of supported models
src/api/models/base.py:27
↓ 1 callersMethod_async_iterate
Helper method to convert sync iterator to async iterator
src/api/models/bedrock.py:411
↓ 1 callersMethod_calc_budget_tokens
( self, max_tokens: int, reasoning_effort: Literal["low", "medium", "high"] )
src/api/models/bedrock.py:1245
↓ 1 callersMethod_convert_tool_spec
(self, func: Function)
src/api/models/bedrock.py:1234
↓ 1 callersMethod_create_response_stream
Parsing the Bedrock stream response chunk. Ref: https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#message-infe
src/api/models/bedrock.py:1005
↓ 1 callersMethod_estimate_reasoning_tokens
Estimate reasoning tokens from reasoningContent blocks. Bedrock doesn't separately report reasoning tokens, so we estimate t
src/api/models/bedrock.py:895
↓ 1 callersMethod_extract_tool_content
Extract text content from various OpenAI SDK tool message formats. Handles: - String content (legacy format) - List of conten
src/api/models/bedrock.py:618
↓ 1 callersMethod_get_max_cache_tokens
Get maximum cacheable tokens limit for the model. Different models have different caching limits: - Claude: No explicit limi
src/api/models/bedrock.py:310
↓ 1 callersMethod_parse_args
(self, embeddings_request: EmbeddingsRequest)
src/api/models/bedrock.py:1341
↓ 1 callersMethod_parse_args
(self, embeddings_request: EmbeddingsRequest)
src/api/models/bedrock.py:1386
↓ 1 callersMethod_parse_args
(self, text: str, dimensions: int | None = None)
src/api/models/bedrock.py:1430
↓ 1 callersMethod_parse_image
Try to get the raw data from an image url. Ref: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ImageSource.html
src/api/models/bedrock.py:1158
↓ 1 callersMethod_parse_messages
Converse API only support user and assistant messages. example output: [{ "role": "user", "content": [{"text
src/api/models/bedrock.py:530
↓ 1 callersMethod_parse_request
Create default converse request body. Also perform validations to tool call etc. Ref: https://docs.aws.amazon.com/bedrock/latest/API
src/api/models/bedrock.py:767
↓ 1 callersMethod_parse_system_prompts
Create system prompts with optional prompt caching support. Prompt caching can be enabled via: 1. ENABLE_PROMPT_CACHING environment v
src/api/models/bedrock.py:465
↓ 1 callersMethod_reframe_multi_payloard
Receive messages and reformat them to comply with the Claude format With OpenAI format requests, it's not a problem to repeatedly receive mes
src/api/models/bedrock.py:669
↓ 1 callersMethodchat
Default implementation for Chat API.
src/api/models/bedrock.py:373
↓ 1 callersMethodchat_stream
Default implementation for Chat Stream API
src/api/models/bedrock.py:417
↓ 1 callersMethodembed
Handle a basic embeddings request.
src/api/models/base.py:73
↓ 1 callersFunctionget_embeddings_model
(model_id: str)
src/api/models/bedrock.py:1509
↓ 1 callersMethodis_supported_modality
(model_id: str, modality: str = "IMAGE")
src/api/models/bedrock.py:1227
↓ 1 callersMethodvalidate
Perform basic validation on requests
src/api/models/bedrock.py:221
↓ 1 callersFunctionvalidate_model_id
(model_id: str)
src/api/routers/model.py:18
Method_create_response
( self, embeddings: list[float], model: str, input_tokens: int = 0, ou
src/api/models/bedrock.py:1310
Functionapi_key_auth
( credentials: Annotated[HTTPAuthorizationCredentials, Depends(security)], )
src/api/auth.py:39
Methodchat
Handle a basic chat completion requests.
src/api/models/base.py:36
Functionchat_completions
( chat_request: Annotated[ ChatRequest, Body( examples=[ {
src/api/routers/chat.py:21
Methodchat_stream
Handle a basic chat completion requests with stream response.
src/api/models/base.py:41
Methodembed
(self, embeddings_request: EmbeddingsRequest)
src/api/models/bedrock.py:1370
Methodembed
(self, embeddings_request: EmbeddingsRequest)
src/api/models/bedrock.py:1410
Methodembed
(self, embeddings_request: EmbeddingsRequest)
src/api/models/bedrock.py:1446
Functionembeddings
( embeddings_request: Annotated[ EmbeddingsRequest, Body( examples=[
src/api/routers/embeddings.py:17
Functionget_model
( model_id: Annotated[ str, Path(description="Model ID", example="anthropic.claude-3-sonne
src/api/routers/model.py:33
Functionhealth
For health check if needed
src/api/app.py:49
Functionlist_models
()
src/api/routers/model.py:24
Methodlist_models
Always refresh the latest model list
src/api/models/bedrock.py:215
Methodvalidate
Validate chat completion requests.
src/api/models/base.py:31
Functionvalidation_exception_handler
(request, exc)
src/api/app.py:55