MCPcopy
hub / github.com/openai/openai-python / test_bedrock_live_response

Function test_bedrock_live_response

tests/lib/bedrock_live.py:70–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68
69
70def test_bedrock_live_response() -> None:
71 model = os.environ.get("BEDROCK_LIVE_MODEL") or "openai.gpt-oss-120b"
72 region = os.environ.get("BEDROCK_LIVE_REGION") or None
73 profile = os.environ.get("BEDROCK_LIVE_PROFILE") or None
74 base_url = os.environ.get("AWS_BEDROCK_BASE_URL") or None
75 if base_url is None:
76 raise RuntimeError(
77 "Set AWS_BEDROCK_BASE_URL to the Bedrock GPT-OSS endpoint, for example "
78 "https://bedrock-mantle.us-west-2.api.aws/v1."
79 )
80
81 with OpenAI(
82 provider=bedrock(
83 region=region,
84 profile=profile,
85 base_url=base_url,
86 api_key=None,
87 ),
88 timeout=60,
89 max_retries=2,
90 ) as client:
91 response = client.responses.create(
92 model=model,
93 input="Reply with exactly: bedrock live test ok",
94 store=False,
95 )
96
97 output_text = response.output_text.strip()
98 assert output_text, f"Bedrock returned no output text for response {response.id}"
99 assert "bedrock live test ok" in output_text.lower()
100 print(f"Bedrock live response {response.id}: {output_text}")

Callers

nothing calls this directly

Calls 4

OpenAIClass · 0.90
bedrockFunction · 0.90
getMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected