@jambonz/llm 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -33,7 +33,7 @@ interface RawCredential {
33
33
  *
34
34
  * Supported vendors: openai, deepseek, anthropic, google, vertex (alias for
35
35
  * vertex-gemini + vertex-openai — both accept the same auth shape), vertex-gemini,
36
- * vertex-openai, bedrock, azure-openai.
36
+ * vertex-openai, bedrock, azure-openai, groq.
37
37
  *
38
38
  * Throws with a clear message if the raw credential is missing required fields.
39
39
  */
package/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ interface RawCredential {
33
33
  *
34
34
  * Supported vendors: openai, deepseek, anthropic, google, vertex (alias for
35
35
  * vertex-gemini + vertex-openai — both accept the same auth shape), vertex-gemini,
36
- * vertex-openai, bedrock, azure-openai.
36
+ * vertex-openai, bedrock, azure-openai, groq.
37
37
  *
38
38
  * Throws with a clear message if the raw credential is missing required fields.
39
39
  */
package/dist/index.js CHANGED
@@ -2457,6 +2457,95 @@ var azureOpenAIFactory = {
2457
2457
  create: () => new AzureOpenAIAdapter()
2458
2458
  };
2459
2459
 
2460
+ // src/adapters/groq/manifest.ts
2461
+ var GROQ_KNOWN_MODELS = [
2462
+ {
2463
+ id: "llama-3.3-70b-versatile",
2464
+ displayName: "Llama 3.3 70B Versatile (Groq)",
2465
+ capabilities: {
2466
+ streaming: true,
2467
+ tools: true,
2468
+ vision: false,
2469
+ systemPrompt: true,
2470
+ maxContextTokens: 128e3
2471
+ }
2472
+ },
2473
+ {
2474
+ id: "llama-3.1-8b-instant",
2475
+ displayName: "Llama 3.1 8B Instant (Groq)",
2476
+ capabilities: {
2477
+ streaming: true,
2478
+ tools: true,
2479
+ vision: false,
2480
+ systemPrompt: true,
2481
+ maxContextTokens: 128e3
2482
+ }
2483
+ },
2484
+ {
2485
+ id: "gemma2-9b-it",
2486
+ displayName: "Gemma 2 9B (Groq)",
2487
+ capabilities: {
2488
+ streaming: true,
2489
+ tools: true,
2490
+ vision: false,
2491
+ systemPrompt: true,
2492
+ maxContextTokens: 8192
2493
+ }
2494
+ }
2495
+ ];
2496
+ var groqManifest = {
2497
+ vendor: "groq",
2498
+ displayName: "Groq",
2499
+ authKinds: [
2500
+ {
2501
+ kind: "apiKey",
2502
+ displayName: "API Key",
2503
+ fields: [
2504
+ {
2505
+ name: "apiKey",
2506
+ label: "API Key",
2507
+ type: "password",
2508
+ required: true,
2509
+ help: "Get an API key from https://console.groq.com/keys (sign in first if needed)"
2510
+ },
2511
+ {
2512
+ name: "baseURL",
2513
+ label: "Base URL",
2514
+ type: "url",
2515
+ required: false,
2516
+ default: "https://api.groq.com/openai/v1",
2517
+ help: "Override only for proxies. Default points at Groq's production endpoint."
2518
+ }
2519
+ ]
2520
+ }
2521
+ ],
2522
+ knownModels: GROQ_KNOWN_MODELS,
2523
+ // Groq exposes /openai/v1/models with the same auth as chat completions.
2524
+ supportsModelListing: true,
2525
+ docsUrl: "https://console.groq.com/docs/api-reference"
2526
+ };
2527
+
2528
+ // src/adapters/groq/adapter.ts
2529
+ var GroqAdapter = class extends OpenAIAdapter {
2530
+ vendor = groqManifest.vendor;
2531
+ init(auth, client) {
2532
+ super.init(
2533
+ {
2534
+ ...auth,
2535
+ baseURL: auth.baseURL ?? "https://api.groq.com/openai/v1"
2536
+ },
2537
+ client
2538
+ );
2539
+ }
2540
+ };
2541
+
2542
+ // src/adapters/groq/factory.ts
2543
+ var groqFactory = {
2544
+ vendor: groqManifest.vendor,
2545
+ manifest: groqManifest,
2546
+ create: () => new GroqAdapter()
2547
+ };
2548
+
2460
2549
  // src/adapters/index.ts
2461
2550
  registerAdapter(openAIFactory);
2462
2551
  registerAdapter(deepseekFactory);
@@ -2466,12 +2555,14 @@ registerAdapter(vertexGeminiFactory);
2466
2555
  registerAdapter(vertexOpenAIFactory);
2467
2556
  registerAdapter(bedrockFactory);
2468
2557
  registerAdapter(azureOpenAIFactory);
2558
+ registerAdapter(groqFactory);
2469
2559
 
2470
2560
  // src/normalize-auth.ts
2471
2561
  function normalizeAuth(vendor, raw) {
2472
2562
  switch (vendor) {
2473
2563
  case "openai":
2474
2564
  case "anthropic":
2565
+ case "groq":
2475
2566
  return requireApiKey(vendor, raw);
2476
2567
  case "deepseek":
2477
2568
  return {