Skip to content

Commit d7155a6

Browse files
authored
chore: Add framework name into UserAgent header for bedrock integration (run-llama#19615)
1 parent f81f3a7 commit d7155a6

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

llama-index-integrations/embeddings/llama-index-embeddings-bedrock/llama_index/embeddings/bedrock/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ def __init__(
147147
retries={"max_attempts": max_retries, "mode": "standard"},
148148
connect_timeout=timeout,
149149
read_timeout=timeout,
150+
user_agent_extra="x-client-framework:llama_index",
150151
)
151152
if botocore_config is None
152153
else botocore_config
@@ -239,6 +240,7 @@ def set_credentials(
239240

240241
try:
241242
import boto3
243+
from botocore.config import Config
242244

243245
session = boto3.Session(**session_kwargs)
244246
except ImportError:
@@ -247,7 +249,8 @@ def set_credentials(
247249
)
248250

249251
if "bedrock-runtime" in session.get_available_services():
250-
self._client = session.client("bedrock-runtime")
252+
config = Config(user_agent_extra="x-client-framework:llama_index")
253+
self._client = session.client("bedrock-runtime", config=config)
251254
else:
252255
self._client = session.client("bedrock")
253256

@@ -311,6 +314,7 @@ def from_credentials(
311314

312315
try:
313316
import boto3
317+
from botocore.config import Config
314318

315319
session = boto3.Session(**session_kwargs)
316320
except ImportError:
@@ -319,7 +323,8 @@ def from_credentials(
319323
)
320324

321325
if "bedrock-runtime" in session.get_available_services():
322-
client = session.client("bedrock-runtime")
326+
config = Config(user_agent_extra="x-client-framework:llama_index")
327+
client = session.client("bedrock-runtime", config=config)
323328
else:
324329
client = session.client("bedrock")
325330
return cls(

llama-index-integrations/embeddings/llama-index-embeddings-bedrock/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dev = [
2727

2828
[project]
2929
name = "llama-index-embeddings-bedrock"
30-
version = "0.6.0"
30+
version = "0.6.1"
3131
description = "llama-index embeddings bedrock integration"
3232
authors = [{name = "Your Name", email = "[email protected]"}]
3333
requires-python = ">=3.9,<4.0"

llama-index-integrations/llms/llama-index-llms-bedrock-converse/llama_index/llms/bedrock_converse/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ def __init__(
252252
retries={"max_attempts": max_retries, "mode": "standard"},
253253
connect_timeout=timeout,
254254
read_timeout=timeout,
255+
user_agent_extra="x-client-framework:llama_index",
255256
)
256257
if botocore_config is None
257258
else botocore_config

llama-index-integrations/llms/llama-index-llms-bedrock-converse/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dev = [
2929

3030
[project]
3131
name = "llama-index-llms-bedrock-converse"
32-
version = "0.8.0"
32+
version = "0.8.1"
3333
description = "llama-index llms bedrock converse integration"
3434
authors = [{name = "Your Name", email = "[email protected]"}]
3535
requires-python = ">=3.9,<4.0"

llama-index-integrations/llms/llama-index-llms-bedrock/llama_index/llms/bedrock/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def __init__(
182182
retries={"max_attempts": max_retries, "mode": "standard"},
183183
connect_timeout=timeout,
184184
read_timeout=timeout,
185+
user_agent_extra="x-client-framework:llama_index",
185186
)
186187
if botocore_config is None
187188
else botocore_config

llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dev = [
2626

2727
[project]
2828
name = "llama-index-llms-bedrock"
29-
version = "0.4.0"
29+
version = "0.4.1"
3030
description = "llama-index llms bedrock integration"
3131
authors = [{name = "Your Name", email = "[email protected]"}]
3232
requires-python = ">=3.9,<4.0"

0 commit comments

Comments
 (0)