yjoonjang commited on
Commit
ba5d290
Β·
verified Β·
1 Parent(s): e82a029

Add API usage

Browse files
Files changed (1) hide show
  1. README.md +34 -1
README.md CHANGED
@@ -21,7 +21,7 @@ tags:
21
 
22
  # KURE-Reranker-nano
23
 
24
- **KURE-Reranker-nano** is a lightweight, approximately **150M-parameter** Korean-English bilingual reranker. It jointly encodes a query and a candidate document and predicts a scalar relevance score.
25
 
26
  ## Key Characteristics
27
 
@@ -112,6 +112,39 @@ for index in torch.argsort(scores, descending=True).tolist():
112
 
113
  </details>
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  ## Korean Reranking Evaluation
116
 
117
  Scores are **nDCG@10**, and throughput is pairs per second (**PPS**).
 
21
 
22
  # KURE-Reranker-nano
23
 
24
+ **KURE-Reranker-nano** is a lightweight, approximately **150M-parameter** Korean-English bilingual reranker. It jointly encodes a query and a candidate document and predicts a scalar relevance score. It is also served through the [KURE API](https://kure.kullm.ai/).
25
 
26
  ## Key Characteristics
27
 
 
112
 
113
  </details>
114
 
115
+ <details>
116
+ <summary>API</summary>
117
+
118
+ KURE-Reranker-nano is served at [kure.kullm.ai](https://kure.kullm.ai/). Sign in with GitHub there to get an API key.
119
+
120
+ ```python
121
+ import os
122
+
123
+ import requests
124
+
125
+ query = "λŒ€ν•œλ―Όκ΅­μ˜ μˆ˜λ„λŠ” μ–΄λ””μΈκ°€μš”?"
126
+ documents = [
127
+ "λŒ€ν•œλ―Όκ΅­μ˜ μˆ˜λ„λŠ” μ„œμšΈμž…λ‹ˆλ‹€.",
128
+ "The capital of South Korea is Seoul.",
129
+ "λ°”λ‚˜λ‚˜λŠ” μ—΄λŒ€ μ§€μ—­μ—μ„œ μž¬λ°°λ˜λŠ” κ³ΌμΌμž…λ‹ˆλ‹€.",
130
+ ]
131
+
132
+ # Results come sorted by relevance_score (sigmoid of the logit, 0 to 1). top_n keeps only the best N
133
+ response = requests.post(
134
+ "https://kure.kullm.ai/api/v1/rerank",
135
+ headers={"Authorization": f"Bearer {os.environ['KURE_API_KEY']}"},
136
+ json={"model": "kure-reranker-nano", "query": query, "documents": documents, "return_documents": True},
137
+ )
138
+ response.raise_for_status()
139
+ for result in response.json()["results"]:
140
+ print(f"{result['relevance_score']:.4f}\t{result['document']['text']}")
141
+ # 0.9984 λŒ€ν•œλ―Όκ΅­μ˜ μˆ˜λ„λŠ” μ„œμšΈμž…λ‹ˆλ‹€.
142
+ # 0.8661 The capital of South Korea is Seoul.
143
+ # 0.0000 λ°”λ‚˜λ‚˜λŠ” μ—΄λŒ€ μ§€μ—­μ—μ„œ μž¬λ°°λ˜λŠ” κ³ΌμΌμž…λ‹ˆλ‹€.
144
+ ```
145
+
146
+ </details>
147
+
148
  ## Korean Reranking Evaluation
149
 
150
  Scores are **nDCG@10**, and throughput is pairs per second (**PPS**).