Skip to content

Commit

Permalink
chore: Remove key type restictions
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith committed Oct 26, 2024
1 parent 942a429 commit 15bd600
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion sdk-bash/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INFERABLE_API_SECRET="sk_cluster_machine_151qeOFp251eH9v0MxRTYDnxOt2wexZQLmIXU8Vb8"
INFERABLE_API_SECRET=""

source ./inferable.sh

Expand Down
18 changes: 9 additions & 9 deletions sdk-dotnet/src/Inferable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

namespace Inferable
{
public class Links
{
public static string DOCS_AUTH = "https://docs.inferable.ai/pages/auth";
}

public class InferableOptions
{
public string? BaseUrl { get; set; }
Expand Down Expand Up @@ -44,17 +49,12 @@ public InferableClient(InferableOptions? options = null, ILogger<InferableClient

if (apiSecret == null)
{
throw new ArgumentNullException(nameof(options.ApiSecret), "APIKey cannot be null.");
throw new ArgumentNullException($"No API Secret provided. Please see ${Links.DOCS_AUTH}");
}

if (!apiSecret.StartsWith("sk_cluster_machine"))
if (!apiSecret.StartsWith("sk_"))
{
if (apiSecret.StartsWith("sk_"))
{
throw new ArgumentException($"Provided non-Machine API Secret. Please see");
}

throw new ArgumentException($"Invalid API Secret. Please see");
throw new ArgumentException($"Invalid API Secret. Please see: {Links.DOCS_AUTH}");
}


Expand Down Expand Up @@ -118,7 +118,7 @@ internal async Task StartService(string name) {
}

if (!this._functionRegistry.ContainsKey(name)) {
throw new Exception($"No functions registered with for service '{name}'");
throw new Exception($"No functions registered for service '{name}'");
}

var functions = this._functionRegistry[name];
Expand Down
2 changes: 1 addition & 1 deletion sdk-node/src/Inferable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class Inferable {
);
}

if (!apiSecret.startsWith("sk_cluster_")) {
if (!apiSecret.startsWith("sk_")) {
throw new InferableError(
`Invalid API Secret. Please see ${links.DOCS_AUTH}`,
);
Expand Down
6 changes: 0 additions & 6 deletions sdk-node/src/eval/promptfoo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,6 @@ class InferablePromptfooProvider implements ApiProvider {
);
}

if (this.apiSecret.startsWith("sk_machine")) {
throw new InferableError(
"This function can not be called with a machine token.",
);
}

const clusterId = process.env.INFERABLE_CLUSTER_ID;

// Fetch existing run
Expand Down

0 comments on commit 15bd600

Please sign in to comment.