Skip to content
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

support milvus db #867

Merged
merged 4 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const X_AI: string = 'x-ai';
export const SAGEMAKER: string = 'sagemaker';
export const NEBIUS: string = 'nebius';
export const RECRAFTAI: string = 'recraft-ai';
export const MILVUS: string = 'milvus';

export const VALID_PROVIDERS = [
ANTHROPIC,
Expand Down Expand Up @@ -129,6 +130,7 @@ export const VALID_PROVIDERS = [
SAGEMAKER,
NEBIUS,
RECRAFTAI,
MILVUS,
];

export const CONTENT_TYPES = {
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/handlerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ export function constructRequest(
// Add any headers that the model might need
headers = {
...baseHeaders,
...(fn === 'proxy' && proxyHeaders),
...headers,
...forwardHeadersMap,
...(fn === 'proxy' && proxyHeaders),
};

let fetchOptions: RequestInit = {
Expand Down Expand Up @@ -345,7 +345,7 @@ export async function tryPost(
fetchOptions.body = transformedRequestBody as FormData;
} else if (
fn == 'proxy' &&
requestContentType.startsWith(CONTENT_TYPES.GENERIC_AUDIO_PATTERN)
requestContentType?.startsWith(CONTENT_TYPES.GENERIC_AUDIO_PATTERN)
) {
fetchOptions.body = transformedRequestBody as ArrayBuffer;
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import QdrantConfig from './qdrant';
import SagemakerConfig from './sagemaker';
import NebiusConfig from './nebius';
import RecraftAIConfig from './recraft-ai';
import MilvusConfig from './milvus';

const Providers: { [key: string]: ProviderConfigs } = {
openai: OpenAIConfig,
Expand Down Expand Up @@ -104,6 +105,7 @@ const Providers: { [key: string]: ProviderConfigs } = {
sagemaker: SagemakerConfig,
nebius: NebiusConfig,
'recraft-ai': RecraftAIConfig,
milvus: MilvusConfig,
};

export default Providers;
18 changes: 18 additions & 0 deletions src/providers/milvus/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ProviderAPIConfig } from '../types';

const MilvusAPIConfig: ProviderAPIConfig = {
getBaseURL: ({ providerOptions }) => {
return providerOptions.customHost || '';
},
headers: ({ providerOptions }) => {
return { Authorization: `Bearer ${providerOptions.apiKey}` };
},
getEndpoint: ({ fn }) => {
switch (fn) {
default:
return '';
}
},
};

export default MilvusAPIConfig;
9 changes: 9 additions & 0 deletions src/providers/milvus/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ProviderConfigs } from '../types';
import MilvusAPIConfig from './api';

const MilvusConfig: ProviderConfigs = {
api: MilvusAPIConfig,
responseTransforms: {},
};

export default MilvusConfig;
Loading