Skip to content

UN-2472 [FIX] Fixed Cost and Tokens not displayed for Aws Bedrock LLM Adapter (Unstract-sdk 0.73.1)#1370

Merged
gaya3-vijayakumar merged 10 commits into
mainfrom
deps/unstract-sdk-0.73.1-token-and-cost-fix-aws-bedrock
Jul 1, 2025
Merged

UN-2472 [FIX] Fixed Cost and Tokens not displayed for Aws Bedrock LLM Adapter (Unstract-sdk 0.73.1)#1370
gaya3-vijayakumar merged 10 commits into
mainfrom
deps/unstract-sdk-0.73.1-token-and-cost-fix-aws-bedrock

Conversation

@pk-zipstack

Copy link
Copy Markdown
Contributor

What

  • Fixed Cost and Tokens not displayed for Aws Bedrock LLM Adapter.
  • Updated the dependencies and tool versions for unstract-sdk 0.73.1 update.

Why

  • With the previous migration from Bedrock to BedrockConverse the tokens were not displayed.

How

  • Added a fix from the SDK side to get the tokens and added a condition in the cost_calculation.py to redirect apac models to us for costs calculation.

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No

Database Migrations

Env Config

Relevant Docs

Related Issues or PRs

Dependencies Versions

Notes on Testing

Screenshots

Checklist

I have read and understood the Contribution Guidelines.

Comment thread platform-service/src/unstract/platform_service/helper/cost_calculation.py Outdated
@pk-zipstack pk-zipstack changed the title [FIX/DEPS] Fixed Cost and Tokens not displayed for Aws Bedrock LLM Adapter (Unstract-sdk 0.73.1) [FIX] Fixed Cost and Tokens not displayed for Aws Bedrock LLM Adapter (Unstract-sdk 0.73.1) Jun 28, 2025
@pk-zipstack pk-zipstack changed the title [FIX] Fixed Cost and Tokens not displayed for Aws Bedrock LLM Adapter (Unstract-sdk 0.73.1) [FIX] UN-2472 - Fixed Cost and Tokens not displayed for Aws Bedrock LLM Adapter (Unstract-sdk 0.73.1) Jun 30, 2025
Comment thread tools/structure/requirements.txt
Comment thread runner/uv.lock
@pk-zipstack pk-zipstack force-pushed the deps/unstract-sdk-0.73.1-token-and-cost-fix-aws-bedrock branch 2 times, most recently from 645541b to efb608c Compare July 1, 2025 06:15
@github-actions

github-actions Bot commented Jul 1, 2025

Copy link
Copy Markdown
Contributor
filepath function $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_logs}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup\_skip}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_client\_init}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image\_exists}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config\_without\_mount}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_run\_container}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image\_for\_sidecar}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{runner/src/unstract/runner/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_sidecar\_container}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{11}}$$ $$\textcolor{#23d18b}{\tt{11}}$$

@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2025

Copy link
Copy Markdown

@gaya3-vijayakumar gaya3-vijayakumar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runner's uv.lock is still showing up some changes. Howeer extra dependency issues seem solved now. Looks good.

@gaya3-vijayakumar gaya3-vijayakumar merged commit c7b7675 into main Jul 1, 2025
7 checks passed
@gaya3-vijayakumar gaya3-vijayakumar deleted the deps/unstract-sdk-0.73.1-token-and-cost-fix-aws-bedrock branch July 1, 2025 07:49
@ritwik-g ritwik-g changed the title [FIX] UN-2472 - Fixed Cost and Tokens not displayed for Aws Bedrock LLM Adapter (Unstract-sdk 0.73.1) UN-2472 [FIX] Fixed Cost and Tokens not displayed for Aws Bedrock LLM Adapter (Unstract-sdk 0.73.1) Jul 1, 2025
pk-zipstack added a commit that referenced this pull request Aug 20, 2025
…LM Adapter (Unstract-sdk 0.73.1) (#1370)

* Added condition to redirect apac cost to us in platform cost_calculation.py and updated deps

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Commit uv.lock changes

* Removed fallback to "US" models for "APAC" models due to cost limitations.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Commit uv.lock changes

* Removed unwanted space in cost_calculation.py

* Updated runner uv.lock

* Added uv.lovk for unstract runner

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: pk-zipstack <187789273+pk-zipstack@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants