Skip to content

Commit 477ecd1

Browse files
committed
done
1 parent e16a8ad commit 477ecd1

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
## Tasks
3737

3838
- [ ] Add error handling to getAnswer & anywhere else
39+
- [ ] Tokenizer
3940
- [ ] Move back to Together SDK w/ helicone + simpler streaming
4041

4142
## Future tasks

app/api/getAnswer/route.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ export async function POST(request: Request) {
4949
}),
5050
);
5151

52-
let debug = finalResults.map(
53-
(result, index) => `[[citation:${index}]] ${result.fullContent} \n\n`,
54-
);
55-
console.log("DEBUG LENGTH");
56-
console.log(debug.toString().length);
57-
5852
const mainAnswerPrompt = `
5953
Given a user question and some context, please write a clean, concise and accurate answer to the question based on the context. You will be given a set of related contexts to the question, each starting with a reference number like [[citation:x]], where x is a number. Please use the context when crafting your answer.
6054
@@ -128,7 +122,7 @@ const cleanedText = (text: string) => {
128122
return newText.substring(0, 20000);
129123
};
130124

131-
async function fetchWithTimeout(url: string, options = {}, timeout = 5000) {
125+
async function fetchWithTimeout(url: string, options = {}, timeout = 3000) {
132126
// Create an AbortController
133127
const controller = new AbortController();
134128
const { signal } = controller;

utils/TogetherAIStream.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface TogetherAIStreamPayload {
1818
stream: boolean;
1919
}
2020

21+
// TODO: Add back the Together TypeScript SDK with Helicone
2122
// const together = new Together({
2223
// apiKey: process.env["TOGETHER_API_KEY"],
2324
// baseURL: "https://together.helicone.ai/v1",
@@ -30,10 +31,10 @@ export async function TogetherAIStream(payload: TogetherAIStreamPayload) {
3031
const encoder = new TextEncoder();
3132
const decoder = new TextDecoder();
3233

33-
// TODO: Add back the Together TypeScript SDK with Helicone
34-
const res = await fetch("https://api.together.xyz/v1/chat/completions", {
34+
const res = await fetch("https://together.helicone.ai/v1/chat/completions", {
3535
headers: {
3636
"Content-Type": "application/json",
37+
"Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`,
3738
Authorization: `Bearer ${process.env.TOGETHER_API_KEY ?? ""}`,
3839
},
3940
method: "POST",

0 commit comments

Comments
 (0)