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

models.json support for Groq #2328

Merged
merged 4 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions packages/components/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,27 @@
}
]
},
{
"name": "groqChat",
"models": [
{
"label": "gemma-7b-it",
"name": "gemma-7b-it"
},
{
"label": "llama3-70b-8192",
"name": "llama3-70b-8192"
},
{
"label": "llama3-8b-8192",
"name": "llama3-8b-8192"
},
{
"label": "mixtral-8x7b-32768",
"name": "mixtral-8x7b-32768"
}
]
},
{
"name": "chatCohere",
"models": [
Expand Down
17 changes: 13 additions & 4 deletions packages/components/nodes/chatmodels/Groq/Groq.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BaseCache } from '@langchain/core/caches'
import { ChatGroq, ChatGroqInput } from '@langchain/groq'
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
import { getModels, MODEL_TYPE } from '../../../src/modelLoader'
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'

class Groq_ChatModels implements INode {
Expand All @@ -18,7 +19,7 @@ class Groq_ChatModels implements INode {
constructor() {
this.label = 'GroqChat'
this.name = 'groqChat'
this.version = 2.0
this.version = 3.0
this.type = 'GroqChat'
this.icon = 'groq.png'
this.category = 'Chat Models'
Expand All @@ -41,8 +42,9 @@ class Groq_ChatModels implements INode {
{
label: 'Model Name',
name: 'modelName',
type: 'string',
placeholder: 'mixtral-8x7b-32768'
type: 'asyncOptions',
loadMethod: 'listModels',
placeholder: 'llama3-70b-8192'
},
{
label: 'Temperature',
Expand All @@ -55,6 +57,13 @@ class Groq_ChatModels implements INode {
]
}

//@ts-ignore
loadMethods = {
async listModels(): Promise<INodeOptionsValue[]> {
return await getModels(MODEL_TYPE.CHAT, 'groqChat')
}
}

async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
const modelName = nodeData.inputs?.modelName as string
const cache = nodeData.inputs?.cache as BaseCache
Expand Down
Loading