-
Notifications
You must be signed in to change notification settings - Fork 1.2k
azure/bedrock api integration #1048
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
Open
sameelarif
wants to merge
24
commits into
main
Choose a base branch
from
sameel/stg-692-azurebedrock-api-integration-serialize
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
76cc39b
allow free modelclientoptions
sameelarif 28f4b6e
Merge branch 'main' into sameel/stg-692-azurebedrock-api-integration-…
sameelarif 1a415bb
Merge branch 'main' into sameel/stg-692-azurebedrock-api-integration-…
sameelarif 04fb315
change zod ver to working build
sameelarif 8eccd56
send client options on every request
sameelarif c6a752d
test bedrock file
filip-michalsky 2931804
add azure test file
filip-michalsky 2f3b8b9
fix bedrock test
sameelarif be8b7a4
Merge branch 'main' into sameel/stg-692-azurebedrock-api-integration-…
sameelarif 27c722c
Update pnpm-lock.yaml
sameelarif 69c3d93
better modelclientoption api handling
sameelarif 467dade
dont override region
sameelarif 0735ca3
fix bedrock example
sameelarif 76b44ae
lint
sameelarif 18937ee
read aws creds from client options obj
sameelarif 0af4acf
update evals cli docs (#1096)
miguelg719 c762944
adding support for new claude 4.5 sonnet agent model (#1099)
Kylejeong2 4bd7412
properly convert custom / mcp tools to anthropic cua format (#1103)
tkattkat ce07cfa
Add current date and page url to agent context (#1102)
miguelg719 06ae0e6
Additional agent logging (#1104)
miguelg719 9fe40fd
fix system prompt
miguelg719 938b51c
remove dup log
miguelg719 607b4c3
pass modelClientOptions for stagehand agent
miguelg719 adec13c
Merge branch 'main' into sameel/stg-692-azurebedrock-api-integration-…
sameelarif File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
import { AISDKCustomProvider, AISDKProvider } from "@/types/llm"; | ||
import { | ||
UnsupportedAISDKModelProviderError, | ||
UnsupportedModelError, | ||
UnsupportedModelProviderError, | ||
} from "@/types/stagehandErrors"; | ||
import { anthropic, createAnthropic } from "@ai-sdk/anthropic"; | ||
import { azure, createAzure } from "@ai-sdk/azure"; | ||
import { cerebras, createCerebras } from "@ai-sdk/cerebras"; | ||
import { createDeepSeek, deepseek } from "@ai-sdk/deepseek"; | ||
import { createGoogleGenerativeAI, google } from "@ai-sdk/google"; | ||
import { createGroq, groq } from "@ai-sdk/groq"; | ||
import { createMistral, mistral } from "@ai-sdk/mistral"; | ||
import { createOpenAI, openai } from "@ai-sdk/openai"; | ||
import { createPerplexity, perplexity } from "@ai-sdk/perplexity"; | ||
import { createTogetherAI, togetherai } from "@ai-sdk/togetherai"; | ||
import { createXai, xai } from "@ai-sdk/xai"; | ||
import { ollama } from "ollama-ai-provider"; | ||
import { LogLine } from "../../types/log"; | ||
import { | ||
AvailableModel, | ||
|
@@ -17,19 +30,6 @@ import { GoogleClient } from "./GoogleClient"; | |
import { GroqClient } from "./GroqClient"; | ||
import { LLMClient } from "./LLMClient"; | ||
import { OpenAIClient } from "./OpenAIClient"; | ||
import { openai, createOpenAI } from "@ai-sdk/openai"; | ||
import { anthropic, createAnthropic } from "@ai-sdk/anthropic"; | ||
import { google, createGoogleGenerativeAI } from "@ai-sdk/google"; | ||
import { xai, createXai } from "@ai-sdk/xai"; | ||
import { azure, createAzure } from "@ai-sdk/azure"; | ||
import { groq, createGroq } from "@ai-sdk/groq"; | ||
import { cerebras, createCerebras } from "@ai-sdk/cerebras"; | ||
import { togetherai, createTogetherAI } from "@ai-sdk/togetherai"; | ||
import { mistral, createMistral } from "@ai-sdk/mistral"; | ||
import { deepseek, createDeepSeek } from "@ai-sdk/deepseek"; | ||
import { perplexity, createPerplexity } from "@ai-sdk/perplexity"; | ||
import { ollama } from "ollama-ai-provider"; | ||
import { AISDKProvider, AISDKCustomProvider } from "@/types/llm"; | ||
|
||
const AISDKProviders: Record<string, AISDKProvider> = { | ||
openai, | ||
|
@@ -97,23 +97,18 @@ const modelToProviderMap: { [key in AvailableModel]: ModelProvider } = { | |
export function getAISDKLanguageModel( | ||
subProvider: string, | ||
subModelName: string, | ||
apiKey?: string, | ||
baseURL?: string, | ||
modelClientOptions?: ClientOptions, | ||
) { | ||
if (apiKey) { | ||
if (modelClientOptions && Object.keys(modelClientOptions).length > 0) { | ||
const creator = AISDKProvidersWithAPIKey[subProvider]; | ||
if (!creator) { | ||
throw new UnsupportedAISDKModelProviderError( | ||
subProvider, | ||
Object.keys(AISDKProvidersWithAPIKey), | ||
); | ||
} | ||
// Create the provider instance with the API key and baseURL if provided | ||
const providerConfig: { apiKey: string; baseURL?: string } = { apiKey }; | ||
if (baseURL) { | ||
providerConfig.baseURL = baseURL; | ||
} | ||
const provider = creator(providerConfig); | ||
// Create the provider instance with the custom configuration options | ||
const provider = creator(modelClientOptions); | ||
|
||
// Get the specific model from the provider | ||
return provider(subModelName); | ||
} else { | ||
|
@@ -170,8 +165,7 @@ export class LLMProvider { | |
const languageModel = getAISDKLanguageModel( | ||
subProvider, | ||
subModelName, | ||
clientOptions?.apiKey, | ||
clientOptions?.baseURL, | ||
clientOptions, | ||
); | ||
|
||
return new AISdkClient({ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Import
ClientOptions
from openai but useOpenAI.ClientOptions
in constructor parameter - consider using consistent type reference