Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 04:45 UTC
| 1 | import type { ModelAdapter } from './agent'; |
| 2 | import { anthropicAdapter } from './anthropic-adapter'; |
| 3 | import type { Provider } from './fixtures'; |
| 4 | import { openaiAdapter } from './openai-adapter'; |
| 5 | import type { AdapterInputs } from './run-journey'; |
| 6 | |
| 7 | /** |
| 8 | * Per-turn output cap. Enough for a command and a sentence around it, with |
| 9 | * room for the thinking current models cannot switch off. |
| 10 | */ |
| 11 | export const MAX_OUTPUT_TOKENS = 2048; |
| 12 | |
| 13 | /** |
| 14 | * The key the adapters send. It only ever reaches the local aimock: in replay |
| 15 | * nothing is forwarded, and in record mode aimock swaps a key with this prefix |
| 16 | * for the real one on the way out. |
| 17 | */ |
| 18 | export const PLACEHOLDER_API_KEY = 'sk-aimock-composio-e2e'; |
| 19 | |
| 20 | export const adapterFor = |
| 21 | (provider: Provider, model: string, baseURL: string) => |
| 22 | (inputs: AdapterInputs): ModelAdapter => { |
| 23 | const options = { |
| 24 | baseURL, |
| 25 | apiKey: PLACEHOLDER_API_KEY, |
| 26 | model, |
| 27 | maxTokens: MAX_OUTPUT_TOKENS, |
| 28 | ...inputs, |
| 29 | }; |
| 30 | return provider === 'anthropic' ? anthropicAdapter(options) : openaiAdapter(options); |
| 31 | }; |