Skip to content

Commit

Permalink
chore: switch from zephyr to llama3.1 for summary
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinceBaghel258025 committed Oct 12, 2024
1 parent c389274 commit c883ed4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default function LoggedInLayout({
);
}

const SearchButton = (props: React.ComponentProps<typeof Button>) => {
export const SearchButton = (props: React.ComponentProps<typeof Button>) => {
return (
<Button {...props} variant="ghost" className="max-h-[32px]">
<SearchIcon className="w-4 h-4 mr-2" />
Expand Down
6 changes: 6 additions & 0 deletions src/app/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { z } from "zod";

export const env = createEnv({
server: {
// LITELLM
LITELLM_BASE_URL: z.string().min(1),
LITELLM_API_KEY: z.string().min(10),
// Anthropic
ANTHROPIC_API_KEY: z.string().min(10),
// OpenAI
Expand Down Expand Up @@ -64,6 +67,9 @@ export const env = createEnv({
},

runtimeEnv: {
// LITELLM
LITELLM_BASE_URL: process.env.LITELLM_BASE_URL,
LITELLM_API_KEY: process.env.LITELLM_API_KEY,
// Anthropic
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
// Clerk (Auth)
Expand Down
14 changes: 14 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import { ChatType } from "@/lib/types";
import { parseAsString, useQueryState } from "next-usequerystate";
import ChatCardWrapper from "@/components/chatcardwrapper";
import { OrgChatToggler } from "@/components/chatSidebar";
import AudioPlayer from "@/components/audioplayer";
import Search from "@/components/search";
import { SearchButton } from "./dashboard/layout";
import useSearchDialogState from "@/store/searchDialogStore";

const handleSmoothScroll = (): void => {
if (typeof window !== "undefined") {
Expand Down Expand Up @@ -126,6 +130,7 @@ export default function Home() {
console.error("Error creating new chat:", error);
}
};
const { showSearchDialog, toggleSearchDialog } = useSearchDialogState();

return (
<div>
Expand All @@ -137,6 +142,15 @@ export default function Home() {
variant="secondary"
asChild
></Button>
{isSignedIn ? (
<>
<AudioPlayer />
<SearchButton onClick={toggleSearchDialog}>
<span className="hidden sm:inline">Search</span>
</SearchButton>
<Search orgSlug={orgSlug as string} />
</>
) : null}
</Header>
<div className="absolute top-0 w-full y-0 flex flex-col flex-grow h-screen justify-center items-center gap-2 text-center">
<div className="absolute inset-0 -z-5">
Expand Down
8 changes: 4 additions & 4 deletions src/utils/apiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export const summarizeChat = async (chat: ChatEntry[]): Promise<string> => {
name: "SummarizeChat",
run_type: "llm",
inputs: {
model: "HuggingFaceH4/zephyr-7b-beta",
model: "llama3.1-8b",
messages: msgs as ChatCompletionMessageParam[],
top_p: 0.7,
max_tokens: 512,
Expand All @@ -423,12 +423,12 @@ export const summarizeChat = async (chat: ChatEntry[]): Promise<string> => {
const parentRun = new RunTree(parentRunConfig);

const openai = new OpenAI({
baseURL: env.ANYSCALE_API_BASE,
apiKey: env.ANYSCALE_API_KEY,
baseURL: env.LITELLM_BASE_URL,
apiKey: env.LITELLM_API_KEY,
});
const stream: OpenAI.Chat.ChatCompletion =
await openai.chat.completions.create({
model: "HuggingFaceH4/zephyr-7b-beta",
model: "llama3.1-8b",
messages: [
{ role: "user", content: msg },
] as ChatCompletionMessageParam[],
Expand Down

0 comments on commit c883ed4

Please sign in to comment.