Skip to content

UN-2427 [FEAT]: Dynamically override LLM Profile in API Deployment invocation#1388

Merged
vishnuszipstack merged 14 commits intomainfrom
UN-2427-dynamically-override-llm-profile-in-api-deployment-invocation
Jul 4, 2025
Merged

UN-2427 [FEAT]: Dynamically override LLM Profile in API Deployment invocation#1388
vishnuszipstack merged 14 commits intomainfrom
UN-2427-dynamically-override-llm-profile-in-api-deployment-invocation

Conversation

@vishnuszipstack
Copy link
Contributor

@vishnuszipstack vishnuszipstack commented Jun 30, 2025

Note:-

What

Implemented end-to-end LLM Profile ID propagation from API deployment to workflow
execution with profile-based tool settings override. Structure tool now dynamically
applies profile configurations for LLM, embedding, vector DB, and processing parameters
based on user-defined profiles.

Key features:

  • Complete profile ID propagation chain through workflow execution pipeline
  • Dynamic tool settings override in structure tool with detailed change tracking
  • Profile ownership validation ensuring only owners can use their profiles
  • Comprehensive logging for profile propagation and override debugging
  • SDK integration with profile support branch and AWS dependencies
  • Backward compatibility maintained for existing functionality

Why

Solved critical workflow configuration issues:

  • Users had to manually configure same settings across multiple tools/workflows
  • Saved LLM profiles weren't being applied to tool execution
  • No audit trail for what profile settings were applied during execution
  • Inconsistent tool configurations leading to unreliable results

This enables users to create profiles once and apply them consistently across
executions, improving workflow reliability and development efficiency.

How

Profile ID Propagation Chain:
API Request → Deployment Helper → Workflow Execution → File Processing → Metadata Storage

Key Implementation Points:

  • Added llm_profile_id parameter throughout workflow execution pipeline
  • Enhanced FileData dataclass to carry profile ID through file processing
  • Implemented profile ownership validation in API deployment views
  • Created profile override mapping in structure tool for dynamic configuration
  • Updated platform service helper to use correct profile_id column
  • Added comprehensive change tracking with before/after logging

Files Modified:

  • backend/api_v2/api_deployment_views.py: Added ownership validation
  • backend/workflow_manager/workflow_v2/: Enhanced workflow execution pipeline
  • tools/structure/src/main.py: Implemented profile override logic
  • platform-service/: Fixed profile query and added profile_id column mapping
  • unstract-sdk: Added profile support constants and methods

Security: Profile ownership validation prevents unauthorized profile usage
Logging: Detailed change tracking shows exactly what overrides were applied
Compatibility: All changes optional, preserving existing workflow functionality

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)

Database Migrations

Env Config

Relevant Docs

Related Issues or PRs

Dependencies Versions

Notes on Testing

Screenshots

image
image

Checklist

I have read and understood the Contribution Guidelines.

… override - from api deployment

- Add end-to-end llm_profile_id propagation from API deployment to workflow execution
- Implement profile-based tool settings override in structure tool with detailed change tracking
- Add ownership validation to ensure only profile owners can use their profiles
- Fix platform service helper to use correct profile_id column name
- Update SDK integration with profile support branch and AWS dependencies
- Add comprehensive logging for profile propagation and override debugging
- Enhance structure tool with profile override methods and change reporting
- Propagate llm_profile_id through FileData, workflow execution, and metadata storage
- Add profile override mapping for chunk settings, LLM, embedding, vector DB, and x2text adapters
- Include detailed before/after logging for tool metadata changes

This enables dynamic tool configuration based on user-defined LLM profiles, allowing
users to override tool settings like LLM models, embeddings, and processing parameters
at runtime while maintaining backward compatibility and comprehensive audit logging.
Copy link
Contributor

@chandrasekharan-zipstack chandrasekharan-zipstack left a comment

Choose a reason for hiding this comment

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

@vishnuszipstack it wasn't obvious from the screenshots but I thought that the Copy icon meant duplicating a profile. I think it might confuse users.

I suggest that we display the llm_profile_id (profile_id) against every record (as a greyed out text under the profile name maybe). We can have a little copy icon too next to it

@chandrasekharan-zipstack
Copy link
Contributor

@vishnuszipstack also ensure that the postman collection and our public docs is updated with this parameter

Copy link
Contributor

@chandrasekharan-zipstack chandrasekharan-zipstack left a comment

Choose a reason for hiding this comment

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

LGTM - left a minor concern around moving this validation of llm_profile_id into the serializer or by making use of DRF's permissions

Copy link
Contributor

@muhammad-ali-e muhammad-ali-e left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2025

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
Copy link

sonarqubecloud bot commented Jul 4, 2025

@vishnuszipstack vishnuszipstack merged commit 0f26d75 into main Jul 4, 2025
4 checks passed
@vishnuszipstack vishnuszipstack deleted the UN-2427-dynamically-override-llm-profile-in-api-deployment-invocation branch July 4, 2025 06:02
pk-zipstack pushed a commit that referenced this pull request Aug 20, 2025
…vocation (#1388)

* FEAT: implement complete LLM profile ID propagation and tool settings override - from api deployment

- Add end-to-end llm_profile_id propagation from API deployment to workflow execution
- Implement profile-based tool settings override in structure tool with detailed change tracking
- Add ownership validation to ensure only profile owners can use their profiles
- Fix platform service helper to use correct profile_id column name
- Update SDK integration with profile support branch and AWS dependencies
- Add comprehensive logging for profile propagation and override debugging
- Enhance structure tool with profile override methods and change reporting
- Propagate llm_profile_id through FileData, workflow execution, and metadata storage
- Add profile override mapping for chunk settings, LLM, embedding, vector DB, and x2text adapters
- Include detailed before/after logging for tool metadata changes

This enables dynamic tool configuration based on user-defined LLM profiles, allowing
users to override tool settings like LLM models, embeddings, and processing parameters
at runtime while maintaining backward compatibility and comprehensive audit logging.

* removed unwanted file

* pr comment fixes

* added llm id below to name and moved copy button

* moved llm profile id ownership validation to serializer

* pr comment fixes and removed unwanted code in frontend sonar fix

* sdk version bump up

* Commit uv.lock changes

* sdk version bump up in other places

* Commit uv.lock changes
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