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

No errors thrown even if there is no response #1517

Closed
vishalvibes opened this issue May 7, 2024 · 3 comments
Closed

No errors thrown even if there is no response #1517

vishalvibes opened this issue May 7, 2024 · 3 comments
Labels

Comments

@vishalvibes
Copy link

Description

Service: Groq
Model: Llama 3 70B
Issue: No errors thrown, status shows 200, even when no response is received

Effect: I am not able to understand why sometimes an empty response is coming. And whether it's an issue with Groq or with Vercel AI SDK

Screenshot 2024-05-07 at 10 19 02 PM Screenshot 2024-05-07 at 10 21 05 PM

Code example

server route handler

const openai = new OpenAI();
const groq = createOpenAI({
	apiKey: process.env.GROQ_API_KEY,
	baseURL: "https://api.groq.com/openai/v1",
});

export async function POST(req) {
  const result = await streamText({
		  model,
		  messages,
		  maxTokens: 1500,
		  temperature: 0.5,
		  topP: 1,
		  frequencyPenalty: 1,
	  });
  
  // Respond with a streaming response
  return result.toAIStreamResponse();
}

Client Component

import { useChat } from "ai/react";

const {
		messages,
		input,
		handleInputChange,
		handleSubmit,
		isLoading,
                error
	} = useChat({
		api: "/api/chat"
	});

Additional context

No response

@vishalvibes
Copy link
Author

Seemingly there are some issues going on with the Groq servers. Yet, we should be getting an error 503 instead of 200 here.

@lgrammel
Copy link
Collaborator

lgrammel commented May 8, 2024

Can you try the streamText console example for groq?

https://github.com/vercel/ai/blob/main/examples/ai-core/src/stream-text/groq.ts

One potential issue could be the use of temperature, topP, and frequencyPenalty. Maybe try to add them step by step to the example and see if they are related to the error that you are seeing.

@lgrammel
Copy link
Collaborator

@vishalvibes is this still an issue? if so, please re-open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants