-
Notifications
You must be signed in to change notification settings - Fork 878
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from langchain-ai/nc/15apr/render-search-tool…
…-output Render output of search tool using DocumentList and markdown parser
- Loading branch information
Showing
10 changed files
with
138 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { MarkedOptions, marked } from "marked"; | ||
import DOMPurify from "dompurify"; | ||
import { cn } from "../utils/cn"; | ||
|
||
const OPTIONS: MarkedOptions = { | ||
gfm: true, | ||
breaks: true, | ||
}; | ||
|
||
export function StringViewer(props: { value: string; className?: string }) { | ||
return ( | ||
<div | ||
className={cn("text-gray-900 prose", props.className)} | ||
dangerouslySetInnerHTML={{ | ||
__html: DOMPurify.sanitize(marked(props.value, OPTIONS)).trim(), | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
export interface FunctionDefinition { | ||
name?: string; | ||
arguments?: string; | ||
} | ||
|
||
export interface MessageDocument { | ||
page_content: string; | ||
metadata: Record<string, unknown>; | ||
} | ||
|
||
export interface Message { | ||
id: string; | ||
type: string; | ||
content: string | MessageDocument[] | object; | ||
name?: string; | ||
additional_kwargs?: { | ||
name?: string; | ||
function_call?: FunctionDefinition; | ||
tool_calls?: { | ||
id: string; | ||
function?: FunctionDefinition; | ||
}[]; | ||
}; | ||
example: boolean; | ||
} | ||
|
||
export interface Chat { | ||
assistant_id: string; | ||
thread_id: string; | ||
name: string; | ||
updated_at: string; | ||
} |