Skip to content

Commit 19e6d43

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feat/papersearch
2 parents bbb36d1 + 399ecd8 commit 19e6d43

File tree

6 files changed

+92
-17
lines changed

6 files changed

+92
-17
lines changed

packages/tasks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@huggingface/tasks",
33
"packageManager": "[email protected]",
4-
"version": "0.19.6",
4+
"version": "0.19.7",
55
"description": "List of ML tasks for huggingface.co/tasks",
66
"repository": "https://github.com/huggingface/huggingface.js.git",
77
"publishConfig": {

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,39 @@ export const keras_hub = (model: ModelData): string[] => {
593593
return snippets;
594594
};
595595

596+
export const kimi_audio = (model: ModelData): string[] => [
597+
`# Example usage for KimiAudio
598+
# pip install git+https://github.com/MoonshotAI/Kimi-Audio.git
599+
600+
from kimia_infer.api.kimia import KimiAudio
601+
602+
model = KimiAudio(model_path="${model.id}", load_detokenizer=True)
603+
604+
sampling_params = {
605+
"audio_temperature": 0.8,
606+
"audio_top_k": 10,
607+
"text_temperature": 0.0,
608+
"text_top_k": 5,
609+
}
610+
611+
# For ASR
612+
asr_audio = "asr_example.wav"
613+
messages_asr = [
614+
{"role": "user", "message_type": "text", "content": "Please transcribe the following audio:"},
615+
{"role": "user", "message_type": "audio", "content": asr_audio}
616+
]
617+
_, text = model.generate(messages_asr, **sampling_params, output_type="text")
618+
print(text)
619+
620+
# For Q&A
621+
qa_audio = "qa_example.wav"
622+
messages_conv = [{"role": "user", "message_type": "audio", "content": qa_audio}]
623+
wav, text = model.generate(messages_conv, **sampling_params, output_type="both")
624+
sf.write("output_audio.wav", wav.cpu().view(-1).numpy(), 24000)
625+
print(text)
626+
`,
627+
];
628+
596629
export const lightning_ir = (model: ModelData): string[] => {
597630
if (model.tags.includes("bi-encoder")) {
598631
return [

packages/tasks/src/model-libraries.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
473473
snippets: snippets.keras_hub,
474474
filter: true,
475475
},
476+
"kimi-audio": {
477+
prettyLabel: "KimiAudio",
478+
repoName: "KimiAudio",
479+
repoUrl: "https://github.com/MoonshotAI/Kimi-Audio",
480+
snippets: snippets.kimi_audio,
481+
filter: false,
482+
},
476483
k2: {
477484
prettyLabel: "K2",
478485
repoName: "k2",

packages/tiny-agents/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pnpm add @huggingface/tiny-agents
1616

1717
```bash
1818
npx @huggingface/tiny-agents [command] "agent/id"
19-
2019
```
2120

2221
```
@@ -41,8 +40,8 @@ touch my-agent/agent.json
4140

4241
```json
4342
{
44-
"model": "Qwen/Qwen2.5-72B-Instruct", // model id
45-
"provider": "nebius", // or you can also use a local endpoint base url with `endpointUrl`
43+
"model": "Qwen/Qwen2.5-72B-Instruct",
44+
"provider": "nebius",
4645
"servers": [
4746
{
4847
"type": "stdio",
@@ -55,6 +54,25 @@ touch my-agent/agent.json
5554
}
5655
```
5756

57+
Or using a local or remote endpoint URL:
58+
59+
```json
60+
{
61+
"model": "Qwen/Qwen3-32B",
62+
"endpointUrl": "http://localhost:1234/v1",
63+
"servers": [
64+
{
65+
"type": "stdio",
66+
"config": {
67+
"command": "npx",
68+
"args": ["@playwright/mcp@latest"]
69+
}
70+
}
71+
]
72+
}
73+
74+
```
75+
5876
Where `servers` is a list of MCP servers (we support Stdio, SSE, and HTTP servers).
5977

6078
Optionally, you can add a `PROMPT.md` file to override the default Agent prompt.

packages/tiny-agents/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@huggingface/tiny-agents",
33
"packageManager": "[email protected]",
4-
"version": "0.2.2",
4+
"version": "0.2.3",
55
"description": "Lightweight, composable agents for AI applications",
66
"repository": "https://github.com/huggingface/huggingface.js.git",
77
"publishConfig": {

packages/tiny-agents/src/cli.ts

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,17 @@ async function main() {
114114

115115
const { configJson, prompt } = await loadConfigFrom(loadFrom);
116116

117-
const ConfigSchema = z.object({
118-
model: z.string(),
119-
provider: z.enum(PROVIDERS_OR_POLICIES),
120-
servers: z.array(ServerConfigSchema),
121-
});
117+
const ConfigSchema = z
118+
.object({
119+
model: z.string(),
120+
provider: z.enum(PROVIDERS_OR_POLICIES).optional(),
121+
endpointUrl: z.string().optional(),
122+
apiKey: z.string().optional(),
123+
servers: z.array(ServerConfigSchema),
124+
})
125+
.refine((data) => data.provider !== undefined || data.endpointUrl !== undefined, {
126+
message: "At least one of 'provider' or 'endpointUrl' is required",
127+
});
122128

123129
let config: z.infer<typeof ConfigSchema>;
124130
try {
@@ -129,13 +135,24 @@ async function main() {
129135
process.exit(1);
130136
}
131137

132-
const agent = new Agent({
133-
provider: config.provider,
134-
model: config.model,
135-
apiKey: process.env.HF_TOKEN ?? "",
136-
servers: config.servers,
137-
prompt,
138-
});
138+
const agent = new Agent(
139+
config.endpointUrl
140+
? {
141+
endpointUrl: config.endpointUrl,
142+
model: config.model,
143+
apiKey: config.apiKey ?? process.env.API_KEY ?? process.env.HF_TOKEN,
144+
servers: config.servers,
145+
prompt,
146+
}
147+
: {
148+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
149+
provider: config.provider!,
150+
model: config.model,
151+
apiKey: config.apiKey ?? process.env.API_KEY ?? process.env.HF_TOKEN,
152+
servers: config.servers,
153+
prompt,
154+
}
155+
);
139156

140157
if (command === "serve") {
141158
error(`Serve is not implemented yet, coming soon!`);

0 commit comments

Comments
 (0)