Skip to content

Integrate portkey.ai as multi-provider gateway with tool use support #2

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ from strands import Agent
from strands.models import BedrockModel
from strands.models.ollama import OllamaModel
from strands.models.llamaapi import LlamaAPIModel
from strands.models.portkey import PortkeyModel

# Bedrock
bedrock_model = BedrockModel(
Expand All @@ -142,6 +143,17 @@ llama_model = LlamaAPIModel(
)
agent = Agent(model=llama_model)
response = agent("Tell me about Agentic AI")

# Portkey for all models
portkey_model = PortkeyModel(
api_key="<PORTKEY_API_KEY>",
model_id="anthropic.claude-3-5-sonnet-20241022-v2:0",
virtual_key="<BEDROCK_VIRTUAL_KEY>",
provider="bedrock",
base_url="http://portkey-service-gateway.service.prod.example.com/v1",
)
agent = Agent(model=portkey_model)
response = agent("Tell me about Agentic AI")
```

Built-in providers:
Expand Down
12 changes: 9 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ packages = ["src/strands"]
anthropic = [
"anthropic>=0.21.0,<1.0.0",
]
# Optional dependencies for different AI providers

dev = [
"commitizen>=4.4.0,<5.0.0",
"hatch>=1.0.0,<2.0.0",
Expand Down Expand Up @@ -79,12 +81,16 @@ openai = [
"openai>=1.68.0,<2.0.0",
]

portkey = [
"portkey-ai>=1.0.0,<2.0.0",
]

[tool.hatch.version]
# Tells Hatch to use your version control system (git) to determine the version.
source = "vcs"

[tool.hatch.envs.hatch-static-analysis]
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai"]
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai","portkey"]
dependencies = [
"mypy>=1.15.0,<2.0.0",
"ruff>=0.11.6,<0.12.0",
Expand All @@ -107,7 +113,7 @@ lint-fix = [
]

[tool.hatch.envs.hatch-test]
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai"]
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai", "portkey"]
extra-dependencies = [
"moto>=5.1.0,<6.0.0",
"pytest>=8.0.0,<9.0.0",
Expand All @@ -123,7 +129,7 @@ extra-args = [

[tool.hatch.envs.dev]
dev-mode = true
features = ["dev", "docs", "anthropic", "litellm", "llamaapi", "ollama"]
features = ["dev", "docs", "anthropic", "litellm", "llamaapi", "ollama", "portkey"]



Expand Down
Loading