Skip to content

Commit

Permalink
Merge branch 'ucbepic:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
staru09 authored Nov 13, 2024
2 parents 8e3edfb + 8474acb commit 86109b6
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 210 deletions.
2 changes: 1 addition & 1 deletion docetl/operations/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def _call_llm_with_cache(
len(props) == 1
and list(props.values())[0].get("type") == "string"
and scratchpad is None
and ("ollama" in model or "azure/gpt-4o-mini" in model)
and ("ollama" in model or "azure/gpt-4o-mini" in model or "sagemaker" in model)
):
use_tools = False

Expand Down
31 changes: 18 additions & 13 deletions website/src/components/OperationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ export const OperationCard: React.FC<{ index: number }> = ({ index }) => {

const onOptimize = useCallback(async () => {
if (!operation) return;
console.log("Optimizing operation", operation.id);

try {
// Clear the output
Expand Down Expand Up @@ -757,6 +756,22 @@ export const OperationCard: React.FC<{ index: number }> = ({ index }) => {
[operation, handleOperationUpdate, toast]
);

const handleGuardrailsUpdate = useCallback(
(newGuardrails: string[]) => {
dispatch({ type: "UPDATE_GUARDRAILS", payload: newGuardrails });
debouncedUpdate();
},
[debouncedUpdate]
);

const handleGleaningsUpdate = useCallback(
(newGleanings: { num_rounds: number; validation_prompt: string }) => {
dispatch({ type: "UPDATE_GLEANINGS", payload: newGleanings });
debouncedUpdate();
},
[debouncedUpdate]
);

if (!operation) {
return <SkeletonCard />;
}
Expand Down Expand Up @@ -830,12 +845,7 @@ export const OperationCard: React.FC<{ index: number }> = ({ index }) => {
<>
<Guardrails
guardrails={operation.validate || []}
onUpdate={(newGuardrails) =>
dispatch({
type: "UPDATE_GUARDRAILS",
payload: newGuardrails,
})
}
onUpdate={handleGuardrailsUpdate}
isExpanded={isGuardrailsExpanded}
onToggle={() => dispatch({ type: "TOGGLE_GUARDRAILS" })}
/>
Expand All @@ -846,12 +856,7 @@ export const OperationCard: React.FC<{ index: number }> = ({ index }) => {
operation.type === "filter") && (
<GleaningConfig
gleaning={operation.gleaning || null}
onUpdate={(newGleanings) =>
dispatch({
type: "UPDATE_GLEANINGS",
payload: newGleanings,
})
}
onUpdate={handleGleaningsUpdate}
isExpanded={isGleaningsExpanded}
onToggle={() => dispatch({ type: "TOGGLE_GLEANINGS" })}
/>
Expand Down
Loading

0 comments on commit 86109b6

Please sign in to comment.