Skip to content

Commit c32df21

Browse files
committed
check if the issue comes from the snippet
1 parent 4422980 commit c32df21

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

docs/inference-providers/register-as-a-provider.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -62,37 +62,6 @@ Before proceeding with the next steps, ensure you've implemented the necessary c
6262

6363
Create a new file under packages/inference/src/providers/{provider_name}.ts and copy-paste the following snippet.
6464

65-
```ts
66-
import { TaskProviderHelper } from "./providerHelper";
67-
68-
export class MyNewProviderTask extends TaskProviderHelper {
69-
70-
constructor() {
71-
super("your-provider-name", "your-api-base-url", "task-name");
72-
}
73-
74-
override prepareHeaders(params: HeaderParams, binary: boolean): Record<string, string> {
75-
// Override the headers to use for the request.
76-
return super.prepareHeaders(params, binary);
77-
}
78-
79-
makeRoute(params: UrlParams): string {
80-
// Return the route to use for the request. e.g. /v1/chat/completions route is commonly use for chat completion.
81-
throw new Error("Needs to be implemented");
82-
}
83-
84-
preparePayload(params: BodyParams): Record<string, unknown> {
85-
// Return the payload to use for the request, as a dict.
86-
throw new Error("Needs to be implemented");
87-
}
88-
89-
getResponse(response: TogetherBase64ImageGeneration, outputType?: "url" | "blob"): string | Promise<Blob>{
90-
// Return the response in the expected format.
91-
throw new Error("Needs to be implemented");
92-
}
93-
}
94-
```
95-
9665
Implement the methods that require custom handling. Check out the base implementation to check default behavior. If you don't need to override a method, just remove it. You have to define at least `makeRoute`, `preparePayload` and `getResponse`.
9766

9867
If the provider supports multiple tasks that require different implementations, create dedicated subclasses for each task, following the pattern used in the existing providers implementation, e.g. [Together AI provider implementation](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/providers/together.ts).

0 commit comments

Comments
 (0)