Configuring Models from AWS Bedrock
- Ensure all the necessary softwares are installed
winget install --id Git.Git -e --source winget
winget install -e --id Python.Python.3.13
winget install -e --id astral-sh.uv
winget install --id Microsoft.VisualStudioCode -e --source winget
winget install --id Amazon.AWSCLI -e --source winget
winget install Microsoft.AzureCLI
- Create an IAM User (Watch Classroom recording)
- Use
North Virginaorus-east-1as region for Bedrock - Now configure aws with access key and secret key
aws configure - Enable bedrock access
AWS Console -> BedRoc -> Model Access -> Request Access
Now lets create a sample to verify aws bedrock access
-
Refer Here for langchains documentation
-
Create a new directory
mkdir aws_connectivity_test
cd aws_connectivity_test
uv init
uv sync
uv add langchain langchain-aws python-dotenv
- Pyproject.toml
[project]
name = "aws-test"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"langchain>=1.2.13",
"langchain-aws>=1.4.1",
"python-dotenv>=1.2.2",
]
- main.py
from langchain_aws import ChatBedrockConverse
def main():
llm = ChatBedrockConverse(
model="amazon.nova-micro-v1:0",
region_name="us-east-1",
temperature=0,
max_tokens=256
)
# Ask a question
response = llm.invoke("What is the capital of France?")
print(response.content)
if __name__ == "__main__":
main()
- Now run
uv run main.pyto get the response
Configuring Models from Azure AI Foundry
- Ensure Azure CLI is installed
- Configure Azure login
az login
- Enabling Azure AI Foundry for model access
how to enable azure ai foundry for serverless models
I want to cheaper phi models with tool calling
-
Refer Here for using langchain or langgraph with azure ai
-
After enabling a model, Create a new folder
mkdir azure_test
cd azure_test
uv init
uv sync
uv add langchain langchain-azure-ai azure-identity python-dotenv
- Todo: Need to configure correctly
