@@ -4,20 +4,20 @@ import type { Data } from "../src/types";
4
4
import type { HfInference } from "@huggingface/inference" ;
5
5
6
6
const env = import . meta. env ;
7
- if ( ! env . HF_ACCESS_TOKEN ) {
8
- console . warn ( "Set HF_ACCESS_TOKEN in the env to run the tests for better rate limits" ) ;
7
+ if ( ! env . HF_TOKEN ) {
8
+ console . warn ( "Set HF_TOKEN in the env to run the tests for better rate limits" ) ;
9
9
}
10
10
11
11
describe ( "HfAgent" , ( ) => {
12
12
it ( "You can create an agent from the hub" , async ( ) => {
13
- const llm = LLMFromHub ( env . HF_ACCESS_TOKEN , "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5" ) ;
14
- const agent = new HfAgent ( env . HF_ACCESS_TOKEN , llm ) ;
13
+ const llm = LLMFromHub ( env . HF_TOKEN , "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5" ) ;
14
+ const agent = new HfAgent ( env . HF_TOKEN , llm ) ;
15
15
expect ( agent ) . toBeDefined ( ) ;
16
16
} ) ;
17
17
18
18
it ( "You can create an agent from an endpoint" , async ( ) => {
19
- const llm = LLMFromEndpoint ( env . HF_ACCESS_TOKEN ?? "" , "endpoint" ) ;
20
- const agent = new HfAgent ( env . HF_ACCESS_TOKEN , llm ) ;
19
+ const llm = LLMFromEndpoint ( env . HF_TOKEN ?? "" , "endpoint" ) ;
20
+ const agent = new HfAgent ( env . HF_TOKEN , llm ) ;
21
21
expect ( agent ) . toBeDefined ( ) ;
22
22
} ) ;
23
23
@@ -42,7 +42,7 @@ describe("HfAgent", () => {
42
42
} ,
43
43
} ;
44
44
45
- const agent = new HfAgent ( env . HF_ACCESS_TOKEN , undefined , [ uppercaseTool , ...defaultTools ] ) ;
45
+ const agent = new HfAgent ( env . HF_TOKEN , undefined , [ uppercaseTool , ...defaultTools ] ) ;
46
46
const code = `
47
47
async function generate() {
48
48
const output = uppercase("hello friends");
@@ -61,7 +61,7 @@ async function generate() {
61
61
message(output);
62
62
}` ;
63
63
64
- const agent = new HfAgent ( env . HF_ACCESS_TOKEN ) ;
64
+ const agent = new HfAgent ( env . HF_TOKEN ) ;
65
65
66
66
await agent . evaluateCode ( code ) . then ( ( output ) => {
67
67
expect ( output . length ) . toBeGreaterThan ( 0 ) ;
@@ -75,7 +75,7 @@ async function generate() {
75
75
toolThatDoesntExist(aaa);
76
76
}` ;
77
77
78
- const hf = new HfAgent ( env . HF_ACCESS_TOKEN ) ;
78
+ const hf = new HfAgent ( env . HF_TOKEN ) ;
79
79
80
80
await hf . evaluateCode ( code ) . then ( ( output ) => {
81
81
expect ( output . length ) . toBeGreaterThan ( 0 ) ;
0 commit comments