MCPcopy Create free account
hub / github.com/Enfoirer/Text2GraphRAG / create_amazon_bedrock_complete_function

Function create_amazon_bedrock_complete_function

nano_graphrag/_llm.py:124–151  ·  view source on GitHub ↗

Factory function to dynamically create completion functions for Amazon Bedrock Args: model_id (str): Amazon Bedrock model identifier (e.g., "us.anthropic.claude-3-sonnet-20240229-v1:0") Returns: Callable: Generated completion function

(model_id: str)

Source from the content-addressed store, hash-verified

122
123
124def create_amazon_bedrock_complete_function(model_id: str) -> Callable:
125 """
126 Factory function to dynamically create completion functions for Amazon Bedrock
127
128 Args:
129 model_id (str): Amazon Bedrock model identifier (e.g., "us.anthropic.claude-3-sonnet-20240229-v1:0")
130
131 Returns:
132 Callable: Generated completion function
133 """
134 async def bedrock_complete(
135 prompt: str,
136 system_prompt: Optional[str] = None,
137 history_messages: List[Any] = [],
138 **kwargs
139 ) -> str:
140 return await amazon_bedrock_complete_if_cache(
141 model_id,
142 prompt,
143 system_prompt=system_prompt,
144 history_messages=history_messages,
145 **kwargs
146 )
147
148 # Set function name for easier debugging
149 bedrock_complete.__name__ = f"{model_id}_complete"
150
151 return bedrock_complete
152
153
154async def gpt_4o_complete(

Callers 1

__post_init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected