Add CoreAIKit (Swift) usage to the card
Browse files
README.md
CHANGED
|
@@ -67,6 +67,20 @@ def score(query, doc, S=512):
|
|
| 67 |
The instruction is swappable per task (the model is instruction-aware). Right-pad is equivalent to
|
| 68 |
the upstream left-pad + `logits[:, -1]` (the graph reads the true last token from the mask).
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
## Bundle layout
|
| 71 |
|
| 72 |
```
|
|
|
|
| 67 |
The instruction is swappable per task (the model is instruction-aware). Right-pad is equivalent to
|
| 68 |
the upstream left-pad + `logits[:, -1]` (the graph reads the true last token from the mask).
|
| 69 |
|
| 70 |
+
### Swift — [CoreAIKit](https://github.com/john-rocky/coreai-kit)
|
| 71 |
+
|
| 72 |
+
Downloads this repo on first use and formats the pair in-process:
|
| 73 |
+
|
| 74 |
+
```swift
|
| 75 |
+
import CoreAIKitEmbeddings
|
| 76 |
+
|
| 77 |
+
let reranker = try await Reranker(model: .qwen3Reranker0_6B)
|
| 78 |
+
let ranked = try await reranker.rerank(
|
| 79 |
+
query: "What is the capital of Japan?",
|
| 80 |
+
documents: ["Tokyo is the capital of Japan.", "Python is a programming language."])
|
| 81 |
+
// ranked[0].document is most relevant; ranked[i].score is P(yes) in [0, 1]
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
## Bundle layout
|
| 85 |
|
| 86 |
```
|