Skip to content
Open
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
50 changes: 50 additions & 0 deletions src/providers/azure-ai-inference/chatComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,56 @@ export const AzureAIInferenceChatCompleteConfig: ProviderConfig = {
response_format: {
param: 'response_format',
},
n: {
param: 'n',
default: 1,
},
logprobs: {
param: 'logprobs',
default: false,
},
top_logprobs: {
param: 'top_logprobs',
},
logit_bias: {
param: 'logit_bias',
},
store: {
param: 'store',
},
metadata: {
param: 'metadata',
},
modalities: {
param: 'modalities',
},
audio: {
param: 'audio',
},
seed: {
param: 'seed',
},
prediction: {
param: 'prediction',
},
reasoning_effort: {
param: 'reasoning_effort',
},
stream_options: {
param: 'stream_options',
},
web_search_options: {
param: 'web_search_options',
},
prompt_cache_key: {
param: 'prompt_cache_key',
},
safety_identifier: {
param: 'safety_identifier',
},
verbosity: {
param: 'verbosity',
},
};

interface AzureAIInferenceChatCompleteResponse extends ChatCompletionResponse {}
Expand Down
10 changes: 4 additions & 6 deletions src/providers/bedrock/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ export const BedrockTitanEmbedConfig: ProviderConfig = {
param: 'inputText',
required: false,
transform: (params: EmbedParams): string | undefined => {
if (
Array.isArray(params.input) &&
typeof params.input[0] === 'object' &&
params.input[0].text
) {
return params.input[0].text;
if (Array.isArray(params.input)) {
if (typeof params.input[0] === 'object' && params.input[0].text)
return params.input[0].text;
else if (typeof params.input[0] === 'string') return params.input[0];
}
if (typeof params.input === 'string') return params.input;
},
Comment on lines 68 to 75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Code Refactor

Issue: Nested conditionals reduce readability and increase complexity.
Fix: Flatten conditionals using early returns.
Impact: Improves code maintainability and readability.

Suggested change
transform: (params: EmbedParams): string | undefined => {
if (
Array.isArray(params.input) &&
typeof params.input[0] === 'object' &&
params.input[0].text
) {
return params.input[0].text;
if (Array.isArray(params.input)) {
if (typeof params.input[0] === 'object' && params.input[0].text)
return params.input[0].text;
else if (typeof params.input[0] === 'string') return params.input[0];
}
if (typeof params.input === 'string') return params.input;
},
transform: (params: EmbedParams): string | undefined => {
if (Array.isArray(params.input)) {
if (typeof params.input[0] === 'object' && params.input[0].text)
return params.input[0].text;
else if (typeof params.input[0] === 'string') return params.input[0];
}
if (typeof params.input === 'string') return params.input;
},

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved: Previous suggestion for flattening conditionals was not applied in this PR but remains relevant

Expand Down