UNPKG

@n8n/n8n-nodes-langchain

Version:

![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

81 lines 2.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AnthropicApi = void 0; class AnthropicApi { constructor() { this.name = 'anthropicApi'; this.displayName = 'Anthropic'; this.documentationUrl = 'anthropic'; this.properties = [ { displayName: 'API Key', name: 'apiKey', type: 'string', typeOptions: { password: true }, required: true, default: '', }, { displayName: 'Base URL', name: 'url', type: 'string', default: 'https://api.anthropic.com', description: 'Override the default base URL for the API', }, { displayName: 'Add Custom Header', name: 'header', type: 'boolean', default: false, }, { displayName: 'Header Name', name: 'headerName', type: 'string', displayOptions: { show: { header: [true], }, }, default: '', }, { displayName: 'Header Value', name: 'headerValue', type: 'string', typeOptions: { password: true, }, displayOptions: { show: { header: [true], }, }, default: '', }, ]; this.test = { request: { baseURL: '={{$credentials?.url}}', url: '/v1/models', method: 'GET', headers: { 'anthropic-version': '2023-06-01', }, }, }; } async authenticate(credentials, requestOptions) { requestOptions.headers ??= {}; requestOptions.headers['x-api-key'] = credentials.apiKey; if (credentials.header && typeof credentials.headerName === 'string' && credentials.headerName && typeof credentials.headerValue === 'string') { requestOptions.headers[credentials.headerName] = credentials.headerValue; } return requestOptions; } } exports.AnthropicApi = AnthropicApi; //# sourceMappingURL=AnthropicApi.credentials.js.map