Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
36 changes: 36 additions & 0 deletions src/providers/databricks/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { ProviderAPIConfig } from '../types';

const DatabricksAPIConfig: ProviderAPIConfig = {
getBaseURL: ({ providerOptions }) => {
// Support custom base URL or construct from workspace
if (providerOptions.databricksBaseURL) {
return providerOptions.databricksBaseURL;
}
const workspace = providerOptions.databricksWorkspace;
if (!workspace) {
throw new Error('Databricks workspace or base URL must be provided');
}
return `https://${workspace}.cloud.databricks.com/serving-endpoints`;
},
headers: ({ providerOptions }) => {
const headersObj: Record<string, string> = {
Authorization: `Bearer ${providerOptions.apiKey}`,
};

return headersObj;
},
getEndpoint: ({ fn }) => {
// Databricks uses /invocations for all endpoints
// The base URL should include the model name: /serving-endpoints/{model}/invocations
switch (fn) {
case 'complete':
case 'chatComplete':
case 'embed':
return '/invocations';
default:
return '';
}
},
};

export default DatabricksAPIConfig;
Loading