OAI: Allow /v1/encode endpoint to handle vision requests

* More robust checks for OAI chat completion message lists on /v1/encode endpoint
* Added TODO to support other aspects of chat completions
* Fix oversight where embeddings was not defined in advance on /v1/chat/completions endpoint
This commit is contained in:
DocShotgun
2024-11-19 11:14:37 -08:00
parent c42655336b
commit 5611365c07
4 changed files with 36 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
import asyncio
from common.multimodal import MultimodalEmbeddingWrapper
from fastapi import APIRouter, Depends, HTTPException, Request
from sse_starlette import EventSourceResponse
from sys import maxsize
@@ -124,6 +125,8 @@ async def chat_completion_request(
model_path = model.container.model_dir
embeddings = MultimodalEmbeddingWrapper()
if isinstance(data.messages, str):
prompt = data.messages
else: