- 
                Notifications
    
You must be signed in to change notification settings  - Fork 35
 
Closed
Description
When using Gemini via Vertex AI, the OpenAiChatCompletionService returns unexpected finish reason values of the form "1: ", "2: ", etc., but I would expect to get the Gemini reason names "STOP", "MAX_TOKENS", etc. as listed here.
Code example:
val service: OpenAIChatCompletionService = VertexAIServiceFactory.asOpenAI(
    projectId = ...,
    location = ...
)
val settings = CreateChatCompletionSettings(model = "gemini-1.5-flash-001")
val response = Await.result(
    service.createChatCompletion(Seq(domain.UserMessage("Just reply with 'ABC'")), settings),
    Duration.Inf
)
// finishReason is '1: ' here
val finishReason = response.choices.head.finish_reason.getSimilarly, the streaming library returns a finish_reason with value Some(0: ) on all but the last ChatCompletionChoiceChunkInfo object, however I think this should be None.
Looking at the code, I see that this line uses getFinishMessage to construct the reason name, however this message is an empty string for Gemini.
Metadata
Metadata
Assignees
Labels
No labels