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

chore: Update useInferableRuntime auth options #294

Merged
merged 1 commit into from
Dec 11, 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
6 changes: 4 additions & 2 deletions adapters/assistant-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import { AssistantRuntimeProvider, Thread } from "@assistant-ui/react";

const { runtime, run } = useInferableRuntime({
clusterId: '<YOUR_CLUSTER_ID>',
apiSecret: '<YOUR_API_SECRET>',
customAuthToken: 'your-custom-auth-token',
// apiSecret: 'your-api-secret', // Not recommended
onError: (error) => {
console.error(error);
}
Expand All @@ -63,7 +64,8 @@ You can handle errors by providing an `onError` callback:
```typescript
const { runtime, run } = useInferableRuntime({
clusterId: '<YOUR_CLUSTER_ID>',
apiSecret: '<YOUR_API_SECRET>',
customAuthToken: 'your-custom-auth-token',
// apiSecret: 'your-api-secret', // Not recommended
onError: (error) => {
console.error(error);
}
Expand Down
8 changes: 4 additions & 4 deletions adapters/assistant-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion adapters/assistant-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"vite": "^6.0.3"
},
"dependencies": {
"@inferable/react": "^0.0.7"
"@inferable/react": "^0.0.8"
}
}
19 changes: 11 additions & 8 deletions adapters/assistant-ui/src/inferable-provider-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ type RuntimeOptions = {
clusterId: string;

/**
* The API secret to use for authentication.
* The cluster API secret to use for authentication.
* This is not recommended as the key will be available in the browser.
*
* @see https://docs.inferable.ai/pages/auth
*/
apiSecret: string;
apiSecret?: string;

/**
* The authentication mode to use.
* @default "cluster"
* @see http://docs.inferable.ai/pages/auth
* A custom auth token to use for authentication.
*
* @see https://docs.inferable.ai/pages/custom-auth
*/
authType?: "custom" | "cluster";
customAuthToken?: string;

/**
* Optional, provided if you want to resume an existing run.
Expand All @@ -39,15 +42,15 @@ type RuntimeOptions = {
export function useInferableRuntime({
clusterId,
apiSecret,
authType,
customAuthToken,
runId,
onError
}: RuntimeOptions) {

const { messages, run, createMessage, start } = useRun({
clusterId,
apiSecret,
authType,
customAuthToken,
onError,
});

Expand Down
Loading