Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission Denied Error While Using Portkey for bedrock models using langchain #440

Closed
Chaitanya-akaike opened this issue Jul 8, 2024 · 2 comments
Labels
bug Something isn't working triage

Comments

@Chaitanya-akaike
Copy link

What Happened?

I was trying out Bedrock models on Portkey , however I keep getting the below error:
PermissionDeniedError: Error code: 403 - {'error': {'message': 'bedrock error: The security token included in the request is invalid.', 'type': None, 'param': None, 'code': None}, 'provider': 'bedrock'}
I have verified the credentials and they are working fine without port key

What Should Have Happened?

This error should not be comming and instead the llm request must go on with status code 200

Relevant Code Snippet

config = {
    "strategy": {
         "mode": "loadbalance"
    },
    "targets": [{
        "virtual_key": os.environ.get("bedrock_virtual_key"), 
        "override_params": {"model": "meta.llama3-70b-instruct-v1:0",}
        
    }]
}
portkey_headers = createHeaders(
    api_key=os.environ.get("api_key"),
    config=config
)

llm = ChatOpenAI(api_key="X", base_url=PORTKEY_GATEWAY_URL, default_headers=portkey_headers)

llm.invoke("What is the meaning of life, universe and everything?")

This is throwing error: PermissionDeniedError: Error code: 403 - {'error': {'message': 'bedrock error: The security token included in the request is invalid.', 'type': None, 'param': None, 'code': None}, 'provider': 'bedrock'}

Your Twitter/LinkedIn

@kumaria3001

@Chaitanya-akaike Chaitanya-akaike added the bug Something isn't working label Jul 8, 2024
@github-actions github-actions bot added the triage label Jul 8, 2024
@VisargD
Copy link
Collaborator

VisargD commented Jul 8, 2024

Hey @Chaitanya-akaike! Few users have faced this in the past because they interchanged access key ID and secret key while creating a virtual key. Can you please double check if thats not the case here?

@Chaitanya-akaike
Copy link
Author

Thanks for the reply, yes indeed that was the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants