mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
add lib tests
This commit is contained in:

committed by
Geoff Seemueller

parent
7019aa30bc
commit
108e5fbd47
@@ -17,7 +17,7 @@ export class GroqChatProvider extends BaseChatProvider {
|
||||
}
|
||||
|
||||
getStreamParams(param: CommonProviderParams, safeMessages: any[]): any {
|
||||
const llamaTuningParams = {
|
||||
const tuningParams = {
|
||||
temperature: 0.86,
|
||||
top_p: 0.98,
|
||||
presence_penalty: 0.1,
|
||||
@@ -29,23 +29,21 @@ export class GroqChatProvider extends BaseChatProvider {
|
||||
model: param.model,
|
||||
messages: safeMessages,
|
||||
stream: true,
|
||||
...llamaTuningParams
|
||||
...tuningParams
|
||||
};
|
||||
}
|
||||
|
||||
async processChunk(chunk: any, dataCallback: (data: any) => void): Promise<boolean> {
|
||||
// Check if this is the final chunk
|
||||
if (chunk.choices && chunk.choices[0]?.finish_reason === "stop") {
|
||||
dataCallback({ type: "chat", data: chunk });
|
||||
return true; // Break the stream
|
||||
return true;
|
||||
}
|
||||
|
||||
dataCallback({ type: "chat", data: chunk });
|
||||
return false; // Continue the stream
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Legacy class for backward compatibility
|
||||
export class GroqChatSdk {
|
||||
private static provider = new GroqChatProvider();
|
||||
|
||||
|
Reference in New Issue
Block a user