Skip to content

Commit b384cc6

Browse files
committed
chore(groq/v1): patch changes
* #8974 * #8917 * #8444 * #8615
1 parent aa938e0 commit b384cc6

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

libs/providers/langchain-groq/src/chat_models.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,6 @@ function convertMessagesToGroqParams(
343343
messages: BaseMessage[]
344344
): Array<ChatCompletionsAPI.ChatCompletionMessage> {
345345
return messages.map((message): ChatCompletionsAPI.ChatCompletionMessage => {
346-
if (typeof message.content !== "string") {
347-
throw new Error("Non string message content not supported");
348-
}
349346
// eslint-disable-next-line @typescript-eslint/no-explicit-any
350347
const completionParam: Record<string, any> = {
351348
role: messageToGroqRole(message),

libs/providers/langchain-groq/src/tests/chat_models.int.test.ts

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ test("streaming", async () => {
8787
test("invoke with bound tools", async () => {
8888
const chat = new ChatGroq({
8989
maxRetries: 0,
90-
model: "llama-3.3-70b-versatile",
90+
model: "moonshotai/kimi-k2-instruct",
9191
});
9292
const message = new HumanMessage("What is the current weather in Hawaii?");
9393
const res = await chat
@@ -168,7 +168,7 @@ test("stream with bound tools, yielding a single chunk", async () => {
168168

169169
test("Few shotting with tool calls", async () => {
170170
const chat = new ChatGroq({
171-
model: "llama-3.3-70b-versatile",
171+
model: "moonshotai/kimi-k2-instruct",
172172
temperature: 0,
173173
}).bindTools(
174174
[
@@ -222,7 +222,7 @@ test("Few shotting with tool calls", async () => {
222222

223223
test("Groq can stream tool calls", async () => {
224224
const model = new ChatGroq({
225-
model: "llama-3.1-70b-versatile",
225+
model: "llama-3.3-70b-versatile",
226226
temperature: 0,
227227
});
228228

@@ -281,3 +281,32 @@ test("response metadata includes groq metadata when streaming", async () => {
281281
// console.dir(finalRes, { depth: Infinity });
282282
expect(finalRes?.response_metadata.x_groq?.id).toBeDefined();
283283
});
284+
285+
test("invoke with image input", async () => {
286+
const chat = new ChatGroq({
287+
maxRetries: 0,
288+
model: "meta-llama/llama-4-scout-17b-16e-instruct",
289+
});
290+
const message = new HumanMessage({
291+
content: [
292+
{
293+
type: "text",
294+
text: "What's in this image?",
295+
},
296+
{
297+
type: "image_url",
298+
image_url: {
299+
url: "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
300+
},
301+
},
302+
],
303+
});
304+
const res = await chat.invoke([message]);
305+
306+
expect(res.content.length).toBeGreaterThan(10);
307+
expect(typeof res.content).toBe("string");
308+
// The response should contain some reference to Google or logo
309+
expect((res.content as string).toLowerCase()).toMatch(
310+
/google|logo|text|image/
311+
);
312+
});

0 commit comments

Comments
 (0)