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 { ToolkitIndex } from 'src/generation/create-toolkit-index'; |
| 2 | import type { SourceFile } from 'src/generation/types'; |
| 3 | import { Effect, type Path } from 'effect'; |
| 4 | import { safeOutputPath, type SafeOutputPathError } from 'src/generation/safe-output-path'; |
| 5 | import { generatePythonToolkitSources } from './generate-toolkit-sources'; |
| 6 | |
| 7 | type GeneratePythonSourcesParams = { |
| 8 | banner: string; |
| 9 | outputDir: string; |
| 10 | }; |
| 11 | |
| 12 | export function generatePythonSources(params: GeneratePythonSourcesParams) { |
| 13 | return ( |
| 14 | index: ToolkitIndex |
| 15 | ): Effect.Effect<Array<SourceFile>, SafeOutputPathError, Path.Path> => { |
| 16 | const toolkiteSources = generatePythonToolkitSources(params.banner)(index); |
| 17 | |
| 18 | return Effect.all( |
| 19 | toolkiteSources.map(([filename, content]) => |
| 20 | safeOutputPath(params.outputDir, filename).pipe( |
| 21 | Effect.map(filePath => [filePath, content] as const) |
| 22 | ) |
| 23 | ) |
| 24 | ); |
| 25 | }; |
| 26 | } |