Skip to content

Commit e4f2d1d

Browse files
Pass also the 'X-BEDROCK-CONVERSE' headers that indicate that the requets should be handled as passthrough from UMG.
1 parent acbbe92 commit e4f2d1d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

singlestoredb/ai/chat.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def SingleStoreChatFactory(
111111
cfg = Config()
112112
if http_client is not None and http_client.timeout is not None:
113113
cfg.timeout = http_client.timeout
114+
cfg.connect_timeout = http_client.timeout
114115
client = boto3.client(
115116
'bedrock-runtime',
116117
endpoint_url=info.connection_url, # redirect requests to UMG
@@ -127,6 +128,10 @@ def _inject_headers(request: Any, **_ignored: Any) -> None:
127128
request.headers['X-S2-OBO'] = obo_val
128129
if token:
129130
request.headers['Authorization'] = f'Bearer {token}'
131+
if streaming:
132+
request.headers['X-BEDROCK-CONVERSE-STREAMING'] = 'true'
133+
else:
134+
request.headers['X-BEDROCK-CONVERSE'] = 'true'
130135

131136
emitter = client._endpoint._event_emitter
132137
emitter.register_first(

0 commit comments

Comments
 (0)