Replace binaries from production build
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +8 -0
- android-arm64/libneedle.a +2 -2
- android-arm64/needle +2 -2
- android-arm64/needle.h +62 -15
- android-armv7/libneedle.a +2 -2
- android-armv7/needle +2 -2
- android-armv7/needle.h +62 -15
- android-riscv64/libneedle.a +2 -2
- android-riscv64/needle +2 -2
- android-riscv64/needle.h +62 -15
- assets/deploy.svg +2 -2
- config.json +1 -1
- ios-arm64/libneedle.a +2 -2
- ios-arm64/needle.h +62 -15
- ios-sim-arm64/libneedle.a +2 -2
- ios-sim-arm64/needle.h +62 -15
- linux-arm64/libneedle.a +2 -2
- linux-arm64/needle +2 -2
- linux-arm64/needle.h +62 -15
- linux-armv7/libneedle.a +2 -2
- linux-armv7/needle +2 -2
- linux-armv7/needle.h +62 -15
- linux-mipsel/libneedle.a +2 -2
- linux-mipsel/needle +2 -2
- linux-mipsel/needle.h +62 -15
- linux-riscv64/libneedle.a +2 -2
- linux-riscv64/needle +2 -2
- linux-riscv64/needle.h +62 -15
- linux-x86_64/libneedle.a +2 -2
- linux-x86_64/needle +2 -2
- linux-x86_64/needle.h +62 -15
- macos-arm64/libneedle.a +2 -2
- macos-arm64/needle +2 -2
- macos-arm64/needle.h +62 -15
- python/cactus_needle-3.1.0-py3-none-macosx_11_0_arm64.whl +3 -0
- python/cactus_needle-3.1.0-py3-none-macosx_11_0_x86_64.whl +3 -0
- python/cactus_needle-3.1.0-py3-none-manylinux2014_aarch64.whl +3 -0
- python/cactus_needle-3.1.0-py3-none-manylinux2014_x86_64.whl +3 -0
- python/cactus_needle-3.1.0-py3-none-musllinux_1_2_aarch64.whl +3 -0
- python/cactus_needle-3.1.0-py3-none-musllinux_1_2_x86_64.whl +3 -0
- python/cactus_needle-3.1.0-py3-none-win_amd64.whl +3 -0
- python/cactus_needle-3.1.0-py3-none-win_arm64.whl +3 -0
- tvos-arm64/libneedle.a +2 -2
- tvos-arm64/needle.h +62 -15
- wasm-component/needle.component.wasm +2 -2
- wasm/needle.h +62 -15
- wasm/needle.js +0 -0
- wasm/needle.wasm +2 -2
- watchos-arm64/libneedle.a +2 -2
- watchos-arm64/needle.h +62 -15
.gitattributes
CHANGED
|
@@ -86,3 +86,11 @@ python/cactus_needle-3.0.2-py3-none-musllinux_1_2_aarch64.whl filter=lfs diff=lf
|
|
| 86 |
python/cactus_needle-3.0.2-py3-none-musllinux_1_2_x86_64.whl filter=lfs diff=lfs merge=lfs -text
|
| 87 |
python/cactus_needle-3.0.2-py3-none-win_amd64.whl filter=lfs diff=lfs merge=lfs -text
|
| 88 |
python/cactus_needle-3.0.2-py3-none-win_arm64.whl filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
python/cactus_needle-3.0.2-py3-none-musllinux_1_2_x86_64.whl filter=lfs diff=lfs merge=lfs -text
|
| 87 |
python/cactus_needle-3.0.2-py3-none-win_amd64.whl filter=lfs diff=lfs merge=lfs -text
|
| 88 |
python/cactus_needle-3.0.2-py3-none-win_arm64.whl filter=lfs diff=lfs merge=lfs -text
|
| 89 |
+
python/cactus_needle-3.1.0-py3-none-macosx_11_0_arm64.whl filter=lfs diff=lfs merge=lfs -text
|
| 90 |
+
python/cactus_needle-3.1.0-py3-none-macosx_11_0_x86_64.whl filter=lfs diff=lfs merge=lfs -text
|
| 91 |
+
python/cactus_needle-3.1.0-py3-none-manylinux2014_aarch64.whl filter=lfs diff=lfs merge=lfs -text
|
| 92 |
+
python/cactus_needle-3.1.0-py3-none-manylinux2014_x86_64.whl filter=lfs diff=lfs merge=lfs -text
|
| 93 |
+
python/cactus_needle-3.1.0-py3-none-musllinux_1_2_aarch64.whl filter=lfs diff=lfs merge=lfs -text
|
| 94 |
+
python/cactus_needle-3.1.0-py3-none-musllinux_1_2_x86_64.whl filter=lfs diff=lfs merge=lfs -text
|
| 95 |
+
python/cactus_needle-3.1.0-py3-none-win_amd64.whl filter=lfs diff=lfs merge=lfs -text
|
| 96 |
+
python/cactus_needle-3.1.0-py3-none-win_arm64.whl filter=lfs diff=lfs merge=lfs -text
|
android-arm64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:16752fb75adea7af89bbc435a97d1cda7e71bc74d04578d551d0d3bbd5f9e633
|
| 3 |
+
size 2128166
|
android-arm64/needle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4a8f2090c5dc7d21ca52b9d167682d5ccb51f730fa21f4c6a700b320c858a17b
|
| 3 |
+
size 1468888
|
android-arm64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
android-armv7/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8cb5af3c2a7e6ad55a1fe94cb9b6c012b40ae921aae2981594362389872fa7c0
|
| 3 |
+
size 1646250
|
android-armv7/needle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eab77b1712b5127201d7e9cbb700f03b3645566347be0446c4818002deeab9d3
|
| 3 |
+
size 893692
|
android-armv7/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
android-riscv64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5580972d83ea6eb466c0989d605935233360564b24f20ef7f671c08e0e8f7482
|
| 3 |
+
size 4634608
|
android-riscv64/needle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:846948100f440c014f046c4615a2ff0cc9febeabef0768fda9db5a4e98f7e82f
|
| 3 |
+
size 1277992
|
android-riscv64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
assets/deploy.svg
CHANGED
|
|
|
|
config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"model_type": "needle",
|
| 3 |
-
"engine_version": "3.
|
| 4 |
"architectures": [
|
| 5 |
"NeedleForToolCalling"
|
| 6 |
],
|
|
|
|
| 1 |
{
|
| 2 |
"model_type": "needle",
|
| 3 |
+
"engine_version": "3.1.0",
|
| 4 |
"architectures": [
|
| 5 |
"NeedleForToolCalling"
|
| 6 |
],
|
ios-arm64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e507b914d32cfe7dfbc9be8de65dc899451d8cbd38a63b2e47bfddaca73373ac
|
| 3 |
+
size 1465680
|
ios-arm64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
ios-sim-arm64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a75a67f98c057cef82977e5e1e3d505b57fed131710a5ae89683ad9d0d74d849
|
| 3 |
+
size 1503120
|
ios-sim-arm64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
linux-arm64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6e33724cab170f0a25bd943d3a8ed5da925fcb793e9fcb1f201bf2478a50f91
|
| 3 |
+
size 1966732
|
linux-arm64/needle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bcf48b66a3e1834e8cb92c9f9998d85d4618d3e949c8a9d293116749a1f0d205
|
| 3 |
+
size 1409312
|
linux-arm64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
linux-armv7/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f3cdfcc9a5e9aa3afcd0af6612fe2d6099f85c31b7fb5a7d486e3362e7e60c57
|
| 3 |
+
size 1732630
|
linux-armv7/needle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9eea74cba1f8660b1d1835d5d1704559bdf06af6736cfa6dc403e9edc19da0a6
|
| 3 |
+
size 1216328
|
linux-armv7/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
linux-mipsel/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3a17c4c012075510c9f24321a98259dd02a2d6e03adf11a492c5951d1cbd5b7e
|
| 3 |
+
size 1636470
|
linux-mipsel/needle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:48aba03a7fd1575c9f0a26a864b04f714e0caba91f311073534dcb331e7b0f98
|
| 3 |
+
size 1773672
|
linux-mipsel/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
linux-riscv64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6e84c1fac7562fc507962a26dd1f25ae4203f755ab16104551fe365dc0833c05
|
| 3 |
+
size 1881996
|
linux-riscv64/needle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a95e703c00e0a8b053e5829c10fd684e387d5fab76adb1c317f8f0a30e2e2c45
|
| 3 |
+
size 1157928
|
linux-riscv64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
linux-x86_64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c0ff309dcf9c2238bd07986d9d100069d568596c2378f0bfedc1677cc02f756
|
| 3 |
+
size 2143656
|
linux-x86_64/needle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b197ceaef3b300a0b14c3a4fde92305527e43f9256c53d2a53d2a2fe8fe69678
|
| 3 |
+
size 1517200
|
linux-x86_64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
macos-arm64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a3b9163abe7b4bd52487c4005506cb35c5163bb9b9587af4ae07ed7587de697d
|
| 3 |
+
size 1503976
|
macos-arm64/needle
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f52c9ce7c05ef44e8d8441584aec9e6ac6054f811866eacd70f33da2462577dc
|
| 3 |
+
size 1073160
|
macos-arm64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
python/cactus_needle-3.1.0-py3-none-macosx_11_0_arm64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad1cba80ede4c058692370964eec4d881a1fdc80014f7210b2d13891bad7d1c6
|
| 3 |
+
size 523657
|
python/cactus_needle-3.1.0-py3-none-macosx_11_0_x86_64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:31a90adbaa898ea65e92b370e80ba5830a346348022a913a8bb254ab7d20bad6
|
| 3 |
+
size 575529
|
python/cactus_needle-3.1.0-py3-none-manylinux2014_aarch64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f2f30a1178856025ab4bf75ef75e1bf28b8d0552cdd5614f7d06cedc1f713606
|
| 3 |
+
size 649611
|
python/cactus_needle-3.1.0-py3-none-manylinux2014_x86_64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a0fc2f682ef18525d4d18583081ac31c1f6f211abe6c0b3bee44811ed7e0347e
|
| 3 |
+
size 671203
|
python/cactus_needle-3.1.0-py3-none-musllinux_1_2_aarch64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5e3c48b2c181d29117949f4f55c57cab8c3ccd08d782302b56489fde9c15f73
|
| 3 |
+
size 649438
|
python/cactus_needle-3.1.0-py3-none-musllinux_1_2_x86_64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:835ea0d5765704b65bfaf286e2e94aa2e6027b9494a18adf0fb845f2e3bc7a04
|
| 3 |
+
size 672183
|
python/cactus_needle-3.1.0-py3-none-win_amd64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4f5fc86abfc50d551cdb237a34b501f36d82d4b6f5911ee7bec4e9532d44dd95
|
| 3 |
+
size 683889
|
python/cactus_needle-3.1.0-py3-none-win_arm64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:39806d54910c207cd0ac5dc60009c8c5330072ef729711d74061faf0e99e7a6c
|
| 3 |
+
size 617795
|
tvos-arm64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fe1105a1f377f40a79a225336256e2cc2b8da18836d0871f549afb31099a6d76
|
| 3 |
+
size 1465744
|
tvos-arm64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
wasm-component/needle.component.wasm
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c07eba8742a3d76c1d7bfbef8129210a70b44e0e7fdcaecdece67f7a4bc4678
|
| 3 |
+
size 4452455
|
wasm/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|
wasm/needle.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
wasm/needle.wasm
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c19b9ddf9c7de4eb4f37e5f1811c5bbea9f099041d2a27284daf89789ee8523d
|
| 3 |
+
size 903655
|
watchos-arm64/libneedle.a
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bc0e82958495dc8a9f041faef071b61300c10472b1d3566fcf41934309cdff70
|
| 3 |
+
size 1486712
|
watchos-arm64/needle.h
CHANGED
|
@@ -5,42 +5,89 @@
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
#ifdef __cplusplus
|
| 9 |
extern "C" {
|
| 10 |
#endif
|
| 11 |
|
| 12 |
-
/* One process-global, non-thread-safe model
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
NEEDLE_API int needle_init(
|
| 17 |
const char* system_prompt,
|
| 18 |
const char* tools_json,
|
| 19 |
const char* tool_index_path
|
| 20 |
);
|
| 21 |
|
| 22 |
-
/*
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
NEEDLE_API int needle_complete(
|
| 26 |
const char* input,
|
|
|
|
|
|
|
| 27 |
int max_new_tokens,
|
| 28 |
char* out,
|
| 29 |
int out_capacity
|
| 30 |
);
|
| 31 |
|
| 32 |
-
/*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
NEEDLE_API void needle_reset(void);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
);
|
| 45 |
|
| 46 |
#ifdef __cplusplus
|
|
|
|
| 5 |
#define NEEDLE_API __attribute__((visibility("default")))
|
| 6 |
#endif
|
| 7 |
|
| 8 |
+
#define NEEDLE_TEXT 1
|
| 9 |
+
#define NEEDLE_SPEECH 2
|
| 10 |
+
|
| 11 |
#ifdef __cplusplus
|
| 12 |
extern "C" {
|
| 13 |
#endif
|
| 14 |
|
| 15 |
+
/* One process-global, non-thread-safe model per kind, text and speech.
|
| 16 |
+
Negative returns indicate failure; call needle_last_error() for the specific
|
| 17 |
+
reason. needle_load reads whichever kind the .cact holds and keeps the other,
|
| 18 |
+
so a build with both models takes one call per model. */
|
| 19 |
+
NEEDLE_API int needle_load(
|
| 20 |
+
const unsigned char* cact,
|
| 21 |
+
unsigned long long n
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/* NEEDLE_TEXT, NEEDLE_SPEECH or both, for the models this process has loaded. */
|
| 25 |
+
NEEDLE_API int needle_models(void);
|
| 26 |
+
|
| 27 |
+
/* Last process-global error, owned by the runtime and valid until the next API call. */
|
| 28 |
+
NEEDLE_API const char* needle_last_error(void);
|
| 29 |
+
|
| 30 |
+
/* needle_init returns the tokenized static-prefix length on success. It can fail
|
| 31 |
+
when the system prompt plus statically-declared tools exceed the context
|
| 32 |
+
window, and reports the measured token count when it does. */
|
| 33 |
NEEDLE_API int needle_init(
|
| 34 |
const char* system_prompt,
|
| 35 |
const char* tools_json,
|
| 36 |
const char* tool_index_path
|
| 37 |
);
|
| 38 |
|
| 39 |
+
/* Answers text or speech: exactly one of input and pcm is non-null. Given pcm,
|
| 40 |
+
the engine transcribes the clip with the loaded speech model, answers the
|
| 41 |
+
transcript, and merges the speech fields into the same JSON object under an
|
| 42 |
+
audio_ prefix. needle_set_audio chooses how that transcription runs. */
|
| 43 |
NEEDLE_API int needle_complete(
|
| 44 |
const char* input,
|
| 45 |
+
const float* pcm,
|
| 46 |
+
int samples,
|
| 47 |
int max_new_tokens,
|
| 48 |
char* out,
|
| 49 |
int out_capacity
|
| 50 |
);
|
| 51 |
|
| 52 |
+
/* Language, keywords and word timestamps for the transcription needle_complete
|
| 53 |
+
runs for itself, with the meanings they have in needle_transcribe. The
|
| 54 |
+
strings are copied. Defaults: detect the language, no keywords, no times. */
|
| 55 |
+
NEEDLE_API void needle_set_audio(
|
| 56 |
+
const char* language,
|
| 57 |
+
const char* keywords,
|
| 58 |
+
int word_timestamps
|
| 59 |
);
|
| 60 |
|
| 61 |
NEEDLE_API void needle_reset(void);
|
| 62 |
|
| 63 |
+
/* Transcribes 16 kHz mono float PCM in [-1, 1], at most 30 s, and returns the
|
| 64 |
+
number of tokens generated. language is "en", "de", "fr", "es", "it", "nl" or
|
| 65 |
+
"pl", or NULL to detect it. keywords is NULL or newline-separated words and
|
| 66 |
+
phrases for keyword biasing. out receives JSON with the transcript, the
|
| 67 |
+
language used, the milliseconds to the first token and the decoder's tokens
|
| 68 |
+
per second after it; silence and steady noise give an empty text and language:
|
| 69 |
+
{"text":"...","language":"en","ttft_ms":0.0,"decode_tps":0.0}
|
| 70 |
+
A non-zero word_timestamps adds each word with times in seconds:
|
| 71 |
+
"words":[{"word":"...","start":0.00,"end":0.00,"probability":0.000}] */
|
| 72 |
+
NEEDLE_API int needle_transcribe(
|
| 73 |
+
const float* pcm,
|
| 74 |
+
int samples,
|
| 75 |
+
const char* language,
|
| 76 |
+
const char* keywords,
|
| 77 |
+
int word_timestamps,
|
| 78 |
+
char* out,
|
| 79 |
+
int out_capacity
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
/* Embeds text or speech: exactly one of input and pcm is non-null. Text returns
|
| 83 |
+
the model's embedding dimension, speech one row of that width per 80 ms frame,
|
| 84 |
+
flattened. A null output returns the float count without computing. */
|
| 85 |
+
NEEDLE_API int needle_embed(
|
| 86 |
+
const char* input,
|
| 87 |
+
const float* pcm,
|
| 88 |
+
int samples,
|
| 89 |
+
float* out,
|
| 90 |
+
int out_capacity
|
| 91 |
);
|
| 92 |
|
| 93 |
#ifdef __cplusplus
|