(
filePath: string,
functionName: string,
context: {
vars: Record<string, VarValue>;
provider?: ApiProvider;
config?: unknown;
},
)
| 18 | * @returns The prompts |
| 19 | */ |
| 20 | export const pythonPromptFunction = async ( |
| 21 | filePath: string, |
| 22 | functionName: string, |
| 23 | context: { |
| 24 | vars: Record<string, VarValue>; |
| 25 | provider?: ApiProvider; |
| 26 | config?: unknown; |
| 27 | }, |
| 28 | ) => { |
| 29 | invariant(context.provider?.id, 'provider.id is required'); |
| 30 | const transformedContext: PromptFunctionContext = { |
| 31 | vars: context.vars, |
| 32 | provider: { |
| 33 | id: |
| 34 | typeof context.provider?.id === 'function' ? context.provider?.id() : context.provider?.id, |
| 35 | label: context.provider?.label, |
| 36 | }, |
| 37 | config: context.config ?? {}, |
| 38 | }; |
| 39 | |
| 40 | return runPython(filePath, functionName, [transformedContext]); |
| 41 | }; |
| 42 | |
| 43 | /** |
| 44 | * Legacy Python prompt function. Runs the whole python file. |
no test coverage detected
searching dependent graphs…