mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-10 12:32:28 +10:00
fix(openai): update Azure API version and improve error handling
This commit is contained in:
@ -1,3 +1,3 @@
|
|||||||
export const DEFAULT_MODEL = "gpt-3.5-turbo";
|
export const DEFAULT_MODEL = "gpt-3.5-turbo";
|
||||||
export const DEFAULT_MAX_TOKENS = 1024;
|
export const DEFAULT_MAX_TOKENS = 1024;
|
||||||
export const DEFAULT_AZURE_API_VERSION = "2025-01-01-preview";
|
export const DEFAULT_AZURE_API_VERSION = "2024-10-21";
|
||||||
|
|||||||
@ -127,7 +127,7 @@ export const OpenAISettings = () => {
|
|||||||
<Trans>
|
<Trans>
|
||||||
You can also integrate with Azure OpenAI by enabling the "Use Azure OpenAI" checkbox
|
You can also integrate with Azure OpenAI by enabling the "Use Azure OpenAI" checkbox
|
||||||
and setting the Resource URL to your Azure OpenAI resource (e.g.,
|
and setting the Resource URL to your Azure OpenAI resource (e.g.,
|
||||||
`https://your-resource.openai.azure.com`). Set the deployment name in the Model field
|
<code>https://your-resource.openai.azure.com</code>). Set the deployment name in the Model field
|
||||||
and specify the appropriate API version for your Azure deployment.
|
and specify the appropriate API version for your Azure deployment.
|
||||||
</Trans>
|
</Trans>
|
||||||
</p>
|
</p>
|
||||||
@ -135,8 +135,8 @@ export const OpenAISettings = () => {
|
|||||||
<p>
|
<p>
|
||||||
<Trans>
|
<Trans>
|
||||||
You can also integrate with Ollama simply by setting the API key to
|
You can also integrate with Ollama simply by setting the API key to
|
||||||
`sk-1234567890abcdef` and the Base URL to your Ollama URL, i.e.
|
<code>sk-1234567890abcdef</code> and the Base URL to your Ollama URL, i.e.
|
||||||
`http://localhost:11434/v1`. You can also pick and choose models and set the max tokens
|
<code>http://localhost:11434/v1</code>. You can also pick and choose models and set the max tokens
|
||||||
as per your preference.
|
as per your preference.
|
||||||
</Trans>
|
</Trans>
|
||||||
</p>
|
</p>
|
||||||
@ -228,8 +228,10 @@ export const OpenAISettings = () => {
|
|||||||
<FormItem className="flex flex-row items-center space-x-3 space-y-0">
|
<FormItem className="flex flex-row items-center space-x-3 space-y-0">
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={field.value}
|
checked={!!field.value}
|
||||||
onCheckedChange={field.onChange}
|
onCheckedChange={(value) => {
|
||||||
|
field.onChange(Boolean(value));
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<div className="space-y-1 leading-none">
|
<div className="space-y-1 leading-none">
|
||||||
|
|||||||
@ -14,21 +14,15 @@ export const openai = () => {
|
|||||||
|
|
||||||
if (isAzure) {
|
if (isAzure) {
|
||||||
if (!baseURL) {
|
if (!baseURL) {
|
||||||
throw new Error(
|
throw new Error(t`Azure OpenAI Base URL is required when using Azure OpenAI.`);
|
||||||
t`Azure OpenAI Base URL is required when using Azure OpenAI.`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
throw new Error(
|
throw new Error(t`Azure OpenAI deployment name (model) is required when using Azure OpenAI.`);
|
||||||
t`Azure OpenAI deployment name (model) is required when using Azure OpenAI.`,
|
}
|
||||||
);
|
|
||||||
|
|
||||||
if (!azureApiVersion) {
|
if (!azureApiVersion) {
|
||||||
throw new Error(
|
throw new Error(t`Azure OpenAI API version is required when using Azure OpenAI.`);
|
||||||
t`Azure OpenAI API version is required when using Azure OpenAI.`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct Azure OpenAI URL: https://your-resource.openai.azure.com/openai/deployments/your-deployment
|
// Construct Azure OpenAI URL: https://your-resource.openai.azure.com/openai/deployments/your-deployment
|
||||||
|
|||||||
Reference in New Issue
Block a user