From 93e12e0dc952ca4bf3eb43dc781889714a8b8e58 Mon Sep 17 00:00:00 2001 From: Saikat Mitra Date: Thu, 2 May 2024 11:41:01 +0530 Subject: [PATCH] feat: add support for tool calls in assistant output (#199) --- .changeset/seven-oranges-decide.md | 9 +++ apps/web/components/json-as-tab.tsx | 12 +++- apps/web/components/sample-output-card.tsx | 60 +++++++++++-------- apps/web/components/tool-calls-view.tsx | 53 ++++++++++++++++ apps/web/components/ui/tabs.tsx | 2 +- packages/ai/src/providers/openai/index.ts | 7 +-- .../executors/run/transformers/assistant.ts | 5 +- packages/types/src/ai/index.ts | 5 +- packages/types/src/index.ts | 3 + 9 files changed, 117 insertions(+), 39 deletions(-) create mode 100644 .changeset/seven-oranges-decide.md create mode 100644 apps/web/components/tool-calls-view.tsx diff --git a/.changeset/seven-oranges-decide.md b/.changeset/seven-oranges-decide.md new file mode 100644 index 00000000..74d1d08a --- /dev/null +++ b/.changeset/seven-oranges-decide.md @@ -0,0 +1,9 @@ +--- +"@empiricalrun/types": minor +"@empiricalrun/core": minor +"@empiricalrun/ai": minor +"web": minor +"@empiricalrun/cli": minor +--- + +feat: add support for assistant tool calls diff --git a/apps/web/components/json-as-tab.tsx b/apps/web/components/json-as-tab.tsx index 8d0aa059..4e7208e4 100644 --- a/apps/web/components/json-as-tab.tsx +++ b/apps/web/components/json-as-tab.tsx @@ -26,6 +26,9 @@ export function JsonAsTab({ onSampleRemove, onEditorContentUpdate, onClickRunAll, + showExpandOption = true, + readonlyContent = false, + scrollableContent = true, }: { storeKey: string; data: { [key: string]: any }; @@ -35,6 +38,9 @@ export function JsonAsTab({ onSampleRemove?: () => void; onEditorContentUpdate?: (key: string, value: string) => void; onClickRunAll?: () => void; + showExpandOption?: boolean; + readonlyContent?: boolean; + scrollableContent?: boolean; }) { const tabs = useMemo( () => defaultTabs || Object.keys(data), @@ -70,7 +76,7 @@ export function JsonAsTab({ <>
<> - {activeTabValue && ( + {activeTabValue && showExpandOption && (