Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: map optimizer metadata error #258

Merged
merged 6 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 4 additions & 3 deletions docetl/optimizers/map_optimizer/plan_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,18 @@ def determine_metadata_with_retry():
map_op = self.operation_creator.create_map_operation(
op_config,
subprompt_output_schema,
split_subprompt ,
split_subprompt,
)

# unnest_ops = self.operation_creator.create_unnest_operations(op_config)
max_plan.extend(smg_ops + [map_op])
max_plan.extend(smg_ops)

sample_map_input = copy.deepcopy(input_data)
for smg_op in smg_ops:
for smg_op in max_plan:
sample_map_input = self._run_operation(smg_op, sample_map_input)

sample_output = self._run_operation(map_op, sample_map_input, is_build=True)
max_plan.append(map_op)

# Generate the combine prompt using the sample output
combine_prompt, is_associative = self.prompt_generator._get_combine_prompt(
Expand Down
9 changes: 8 additions & 1 deletion website/src/components/OperationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ export const OperationCard: React.FC<Props> = ({ index, id }) => {
setTerminalOutput,
namespace,
apiKeys,
systemPrompt,
} = usePipelineContext();
const { toast } = useToast();

Expand Down Expand Up @@ -890,7 +891,10 @@ export const OperationCard: React.FC<Props> = ({ index, id }) => {
name: pipelineName,
sample_size: sampleSize,
optimize: true,
namespace,
clear_intermediate: false,
system_prompt: systemPrompt,
namespace: namespace,
apiKeys: apiKeys,
}),
});

Expand Down Expand Up @@ -931,6 +935,9 @@ export const OperationCard: React.FC<Props> = ({ index, id }) => {
optimizerModel,
connect,
sendMessage,
systemPrompt,
namespace,
apiKeys,
]);

const onShowOutput = useCallback(async () => {
Expand Down
Loading