@jambonz/llm 0.4.4 → 0.4.6

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.cjs CHANGED
@@ -2545,7 +2545,7 @@ var groqManifest = {
2545
2545
  label: "API Key",
2546
2546
  type: "password",
2547
2547
  required: true,
2548
- help: "Get an API key from https://console.groq.com/keys."
2548
+ help: "Get an API key from https://console.groq.com/keys (sign in first if needed)"
2549
2549
  },
2550
2550
  {
2551
2551
  name: "baseURL",
@@ -2585,6 +2585,117 @@ var groqFactory = {
2585
2585
  create: () => new GroqAdapter()
2586
2586
  };
2587
2587
 
2588
+ // src/adapters/huggingface/manifest.ts
2589
+ var HF_KNOWN_MODELS = [
2590
+ {
2591
+ id: "meta-llama/Llama-3.3-70B-Instruct",
2592
+ displayName: "Llama 3.3 70B Instruct (HF Providers)",
2593
+ capabilities: {
2594
+ streaming: true,
2595
+ tools: true,
2596
+ vision: false,
2597
+ systemPrompt: true,
2598
+ maxContextTokens: 128e3
2599
+ }
2600
+ },
2601
+ {
2602
+ id: "meta-llama/Llama-3.1-8B-Instruct",
2603
+ displayName: "Llama 3.1 8B Instruct (HF Providers)",
2604
+ capabilities: {
2605
+ streaming: true,
2606
+ tools: true,
2607
+ vision: false,
2608
+ systemPrompt: true,
2609
+ maxContextTokens: 128e3
2610
+ }
2611
+ },
2612
+ {
2613
+ id: "Qwen/Qwen2.5-72B-Instruct",
2614
+ displayName: "Qwen 2.5 72B Instruct (HF Providers)",
2615
+ capabilities: {
2616
+ streaming: true,
2617
+ tools: true,
2618
+ vision: false,
2619
+ systemPrompt: true,
2620
+ maxContextTokens: 128e3
2621
+ }
2622
+ },
2623
+ {
2624
+ id: "mistralai/Mistral-7B-Instruct-v0.3",
2625
+ displayName: "Mistral 7B Instruct v0.3 (HF Providers)",
2626
+ capabilities: {
2627
+ streaming: true,
2628
+ tools: true,
2629
+ vision: false,
2630
+ systemPrompt: true,
2631
+ maxContextTokens: 32e3
2632
+ }
2633
+ },
2634
+ {
2635
+ id: "deepseek-ai/DeepSeek-V3",
2636
+ displayName: "DeepSeek V3 (HF Providers)",
2637
+ capabilities: {
2638
+ streaming: true,
2639
+ tools: true,
2640
+ vision: false,
2641
+ systemPrompt: true,
2642
+ maxContextTokens: 64e3
2643
+ }
2644
+ }
2645
+ ];
2646
+ var huggingfaceManifest = {
2647
+ vendor: "huggingface",
2648
+ displayName: "HuggingFace Inference Providers",
2649
+ authKinds: [
2650
+ {
2651
+ kind: "apiKey",
2652
+ displayName: "API Key",
2653
+ fields: [
2654
+ {
2655
+ name: "apiKey",
2656
+ label: "HuggingFace Token",
2657
+ type: "password",
2658
+ required: true,
2659
+ help: "Get a token from https://huggingface.co/settings/tokens (Read scope is sufficient). Inference Providers requires a credit balance \u2014 claim the free monthly tier or attach a payment method at https://huggingface.co/billing."
2660
+ },
2661
+ {
2662
+ name: "baseURL",
2663
+ label: "Base URL",
2664
+ type: "url",
2665
+ required: false,
2666
+ default: "https://router.huggingface.co/v1",
2667
+ help: "Override only for proxies. Default is the HF Providers router endpoint."
2668
+ }
2669
+ ]
2670
+ }
2671
+ ],
2672
+ knownModels: HF_KNOWN_MODELS,
2673
+ // The HF router exposes /v1/models with the same Bearer auth.
2674
+ supportsModelListing: true,
2675
+ docsUrl: "https://huggingface.co/docs/inference-providers"
2676
+ };
2677
+
2678
+ // src/adapters/huggingface/adapter.ts
2679
+ var HuggingfaceAdapter = class extends OpenAIAdapter {
2680
+ vendor = huggingfaceManifest.vendor;
2681
+ init(auth, client) {
2682
+ super.init(
2683
+ {
2684
+ ...auth,
2685
+ baseURL: auth.baseURL ?? "https://router.huggingface.co/v1"
2686
+ },
2687
+ client
2688
+ );
2689
+ }
2690
+ };
2691
+
2692
+ // src/adapters/huggingface/factory.ts
2693
+ var huggingfaceFactory = {
2694
+ vendor: huggingfaceManifest.vendor,
2695
+ manifest: huggingfaceManifest,
2696
+ create: () => new HuggingfaceAdapter()
2697
+ };
2698
+
2588
2699
  // src/adapters/index.ts
2589
2700
  registerAdapter(openAIFactory);
2590
2701
  registerAdapter(deepseekFactory);
@@ -2595,12 +2706,15 @@ registerAdapter(vertexOpenAIFactory);
2595
2706
  registerAdapter(bedrockFactory);
2596
2707
  registerAdapter(azureOpenAIFactory);
2597
2708
  registerAdapter(groqFactory);
2709
+ registerAdapter(huggingfaceFactory);
2598
2710
 
2599
2711
  // src/normalize-auth.ts
2600
2712
  function normalizeAuth(vendor, raw) {
2601
2713
  switch (vendor) {
2602
2714
  case "openai":
2603
2715
  case "anthropic":
2716
+ case "groq":
2717
+ case "huggingface":
2604
2718
  return requireApiKey(vendor, raw);
2605
2719
  case "deepseek":
2606
2720
  return {