Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anirud/multi modal model support #169

Open
wants to merge 31 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a42556e
fix ts bug
anirudTT Jan 29, 2025
8eef00f
add console log
anirudTT Jan 30, 2025
9f10864
adds support to input area to allow for file upload
anirudTT Jan 30, 2025
80f55b8
adds flow to send over base64 files to model
anirudTT Jan 30, 2025
eca4b6e
add support to show model names in rag management table
anirudTT Jan 31, 2025
61ffd38
add icon + have it look similar to models deployed table
anirudTT Jan 31, 2025
ab6a52b
add updates to handle uploading image file
anirudTT Feb 4, 2025
dcdc61b
adds new file data + url ts props
anirudTT Feb 4, 2025
320f3fb
add utility file to handle upload and encode images to base64
anirudTT Feb 4, 2025
a305ee7
modify to support showing images
anirudTT Feb 4, 2025
eb6c15c
fix upload open / close in input area
anirudTT Feb 4, 2025
a7f664d
modify to: If files are uploaded or url are sent, to use new message …
anirudTT Feb 4, 2025
c055bb2
update 11b vision to new image tag from tt-inference-server
anirudTT Feb 4, 2025
339e7d7
add image linking component
anirudTT Feb 4, 2025
5790e90
show image as a link preview in chat thread
anirudTT Feb 4, 2025
ff95335
adds some improvements
anirudTT Feb 4, 2025
5db7227
allow url / links to be passed in correct post structure
anirudTT Feb 4, 2025
b9ba0ae
add better user feedback to input upload area
anirudTT Feb 5, 2025
adce895
add tooltips to upload icon to help convey to the user
anirudTT Feb 5, 2025
c2cfe1f
add better error feedback on uploads
anirudTT Feb 5, 2025
9b41c41
adds features for the image sent via user:
anirudTT Feb 19, 2025
d0ebba4
- adds border bettwen image and text in chat thread
anirudTT Feb 19, 2025
3afb319
change default prompt to allow user prompt + image to be passed to model
anirudTT Feb 19, 2025
7ab1147
add loading and error states to rag view
anirudTT Feb 19, 2025
82d1711
updates rag form error handling and toast
anirudTT Feb 19, 2025
60ad6d6
Adds better control when user tries to replace upload rag document
anirudTT Feb 20, 2025
f8314c9
Anirud/add rag context to chat thread (#199)
anirudTT Feb 25, 2025
29fb80a
fix merge issues
anirudTT Feb 25, 2025
75f657f
remove unused console log
anirudTT Feb 25, 2025
5ea5c48
Merge branch 'dev' into anirud/multi-modal-model-support
anirudTT Feb 25, 2025
0af2715
Merge branch 'anirud/multi-modal-model-support' of https://github.com…
anirudTT Feb 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/api/shared_config/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def base_docker_config():
ModelImpl(
hf_model_id="meta-llama/Llama-3.2-11B-Vision-Instruct",
image_name="ghcr.io/tenstorrent/tt-inference-server/vllm-llama3-src-dev-ubuntu-20.04-amd64",
image_tag="v0.0.1-47fb1a2fb6e0-2f33504bad49",
image_tag="v0.0.1-70206b9cf111-b9564bf364e9",
device_configurations={DeviceConfigurations.N300x4},
docker_config=base_docker_config(),
service_route="/v1/chat/completions",
Expand Down
9 changes: 7 additions & 2 deletions app/api/vector_db_control/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
#
# SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC
# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC

import uuid
from typing import List
Expand Down Expand Up @@ -71,15 +71,20 @@ def insert_document(self, request, pk=None):
file = request.FILES["file"]
loaded_document = pypdf.PdfReader(stream=file)
chunks = chunk_pdf_document(loaded_document)
ids = [str(uuid.uuid4()) for i in range(0, len(chunks))]
ids = [str(uuid.uuid4()) for _ in range(len(chunks))]
documents = [chunk.page_content for chunk in chunks]

insert_to_chroma_collection(
collection_name=pk,
documents=documents,
ids=ids,
metadatas=[],
embedding_func_name=self.EMBED_MODEL,
)
collection = get_collection(collection_name=pk, embedding_func_name=self.EMBED_MODEL)
metadata = collection.metadata or {}
metadata.update({"last_uploaded_document": file.name})
collection.modify(metadata={k: v for k, v in metadata.items() if k != "hnsw:space"})

return Response(status=200)

Expand Down
195 changes: 195 additions & 0 deletions app/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"html-react-parser": "^5.1.18",
"lucide-react": "^0.460.0",
"mini-svg-data-uri": "^1.4.4",
"pdfjs-dist": "^4.10.38",
"re-resizable": "^6.10.3",
"react": "^18.3.1",
"react-code-blocks": "^0.1.6",
Expand Down
39 changes: 22 additions & 17 deletions app/frontend/src/components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC
"use client";

import { useMemo, useRef, useEffect } from "react";
import React, { useMemo, useRef, useEffect } from "react";
import { NavLink, useLocation, useNavigate } from "react-router-dom";
import { motion } from "framer-motion";
import {
Expand Down Expand Up @@ -45,19 +45,21 @@ interface AnimatedIconProps {
className?: string;
}

const AnimatedIcon: React.FC<AnimatedIconProps> = ({
icon: Icon,
...props
}) => (
<motion.div
whileHover={{ scale: 1.2 }}
whileTap={{ scale: 0.9 }}
transition={{ type: "spring", stiffness: 400, damping: 17 }}
>
<Icon {...props} />
</motion.div>
const AnimatedIcon = React.forwardRef<HTMLDivElement, AnimatedIconProps>(
({ icon: Icon, ...props }, ref) => (
<motion.div
ref={ref}
whileHover={{ scale: 1.2 }}
whileTap={{ scale: 0.9 }}
transition={{ type: "spring", stiffness: 400, damping: 17 }}
>
<Icon {...props} />
</motion.div>
)
);

AnimatedIcon.displayName = "AnimatedIcon";

export default function NavBar() {
const location = useLocation();
const navigate = useNavigate();
Expand Down Expand Up @@ -298,7 +300,8 @@ export default function NavBar() {
{isChatUI ? (
<Tooltip>
<TooltipTrigger asChild>
<FileText
<AnimatedIcon
icon={FileText}
className={`mr-2 ${iconColor} transition-colors duration-300 ease-in-out hover:text-TT-purple`}
/>
</TooltipTrigger>
Expand All @@ -308,7 +311,8 @@ export default function NavBar() {
</Tooltip>
) : (
<>
<FileText
<AnimatedIcon
icon={FileText}
className={`mr-2 ${iconColor} transition-colors duration-300 ease-in-out hover:text-TT-purple`}
/>
<span>Logs</span>
Expand All @@ -333,7 +337,8 @@ export default function NavBar() {
models.length > 0 ? "" : "opacity-50 cursor-not-allowed"
}`}
>
<BotMessageSquare
<AnimatedIcon
icon={BotMessageSquare}
className={`mr-2 ${iconColor} transition-colors duration-300 ease-in-out hover:text-TT-purple`}
/>
{!isChatUI && <span>Chat UI</span>}
Expand Down Expand Up @@ -363,7 +368,8 @@ export default function NavBar() {
models.length > 0 ? "" : "opacity-50 cursor-not-allowed"
}`}
>
<Eye
<AnimatedIcon
icon={Eye}
className={`mr-2 ${iconColor} transition-colors duration-300 ease-in-out hover:text-TT-purple`}
/>
{!isChatUI && <span>Object Detection</span>}
Expand Down Expand Up @@ -478,4 +484,3 @@ export default function NavBar() {
</TooltipProvider>
);
}

Loading