Skip to content

Commit

Permalink
feat(trieve): add search_type config parameter (#1188)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Nov 20, 2024
1 parent 09a2a38 commit 11f3ca4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tasty-bees-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@assistant-ui/react-trieve": patch
---

feat: add search_type config parameter
1 change: 1 addition & 0 deletions examples/with-trieve/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const RuntimeProvider = () => {
value: "poll",
},
],
search_type: "fulltext",
});

return (
Expand Down
5 changes: 4 additions & 1 deletion packages/react-trieve/src/runtime/useTrieveRuntime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { toTrieveStream, TrieveStreamPart } from "../trieve/trieveStream";
import { ChunkMetadata, TrieveSDK } from "trieve-ts-sdk";
import { ChunkMetadata, SearchMethod, TrieveSDK } from "trieve-ts-sdk";
import { TrieveMessage } from "../trieve/TrieveMessage";
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";

Expand Down Expand Up @@ -78,10 +78,12 @@ export const useTrieveRuntime = ({
trieve,
ownerId,
tags,
search_type,
}: {
trieve: TrieveSDK;
ownerId: string;
tags?: TrieveTag[];
search_type: SearchMethod;
}) => {
const [title, setTitle] = useState("");
const threadIdRef = useRef<string | undefined>();
Expand Down Expand Up @@ -227,6 +229,7 @@ export const useTrieveRuntime = ({
.createMessageReader({
topic_id: threadIdRef.current,
new_message_content: userMessage,
search_type,
filters: getFilter(),
})
.then(toTrieveStream)
Expand Down

0 comments on commit 11f3ca4

Please sign in to comment.