Skip to content

Commit 9e10570

Browse files
committed
feat: Adding portkey.ai gateway as a custom model
1 parent aff928c commit 9e10570

File tree

4 files changed

+630
-1
lines changed

4 files changed

+630
-1
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ from strands import Agent
118118
from strands.models import BedrockModel
119119
from strands.models.ollama import OllamaModel
120120
from strands.models.llamaapi import LlamaAPIModel
121+
from strands.models.portkey import PortkeyModel
121122

122123
# Bedrock
123124
bedrock_model = BedrockModel(
@@ -142,6 +143,17 @@ llama_model = LlamaAPIModel(
142143
)
143144
agent = Agent(model=llama_model)
144145
response = agent("Tell me about Agentic AI")
146+
147+
# Portkey for all models
148+
portkey_model = PortkeyModel(
149+
api_key="<PORTKEY_API_KEY>",
150+
model_id="anthropic.claude-3-5-sonnet-20241022-v2:0",
151+
virtual_key="<BEDROCK_VIRTUAL_KEY>",
152+
provider="bedrock",
153+
base_url="http://portkey-service-gateway.service.prod.example.com/v1",
154+
)
155+
agent = Agent(model=portkey_model)
156+
response = agent("Tell me about Agentic AI")
145157
```
146158

147159
Built-in providers:

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ packages = ["src/strands"]
5050
anthropic = [
5151
"anthropic>=0.21.0,<1.0.0",
5252
]
53+
# Optional dependencies for different AI providers
54+
portkey = [
55+
"portkey-ai>=1.0.0,<2.0.0",
56+
]
57+
5358
dev = [
5459
"commitizen>=4.4.0,<5.0.0",
5560
"hatch>=1.0.0,<2.0.0",
@@ -107,7 +112,7 @@ lint-fix = [
107112
]
108113

109114
[tool.hatch.envs.hatch-test]
110-
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai"]
115+
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai", "portkey"]
111116
extra-dependencies = [
112117
"moto>=5.1.0,<6.0.0",
113118
"pytest>=8.0.0,<9.0.0",

0 commit comments

Comments
 (0)