File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
packages/tasks/src/snippets Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,10 @@ import type { ModelDataMinimal } from "./types.js";
55export const snippetConversational = ( model : ModelDataMinimal , accessToken : string ) : string =>
66 `from huggingface_hub import InferenceClient
77
8- client = InferenceClient(
9- "${ model . id } ",
10- token="${ accessToken || "{API_TOKEN}" } ",
11- )
8+ client = InferenceClient(api_key="${ accessToken || "{API_TOKEN}" } ")
129
1310for message in client.chat_completion(
11+ model="${ model . id } ",
1412 messages=[{"role": "user", "content": "What is the capital of France?"}],
1513 max_tokens=500,
1614 stream=True,
@@ -20,13 +18,12 @@ for message in client.chat_completion(
2018export const snippetConversationalWithImage = ( model : ModelDataMinimal , accessToken : string ) : string =>
2119 `from huggingface_hub import InferenceClient
2220
23- client = InferenceClient(
24- "${ model . id } ",
25- token="${ accessToken || "{API_TOKEN}" } ",
26- )
21+ client = InferenceClient(api_key="${ accessToken || "{API_TOKEN}" } ")
22+
2723image_url = "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
2824
2925for message in client.chat_completion(
26+ model="${ model . id } ",
3027 messages=[
3128 {
3229 "role": "user",
You can’t perform that action at this time.
0 commit comments