Skip to content

Commit

Permalink
chore: clean the code
Browse files Browse the repository at this point in the history
  • Loading branch information
chuang8511 committed Dec 4, 2024
1 parent a43a789 commit 2c808cf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
30 changes: 29 additions & 1 deletion pkg/component/data/pinecone/v0/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,35 @@ Writes vectors into a namespace. If a new value is upserted for an existing vect

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Upserted Count | `upserted-count` | integer | Number of records modified or added |
| Upserted Count | `upserted-count` | integer | Number of records modified or added. |
</div>


### Rerank

Rerank documents, such as text passages, according to their relevance to a query. The input is a list of documents and a query. The output is a list of documents, sorted by relevance to the query.

<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_RERANK` |
| Query (required) | `query` | string | The query to rerank the documents. |
| Documents (required) | `documents` | array[string] | The documents to rerank. |
| Top N | `top-n` | integer | The number of results to return sorted by relevance. Defaults to the number of inputs. |
</div>






<div class="markdown-col-no-wrap" data-col-1 data-col-2>

| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Reranked Documents. | `documents` | array[string] | Reranked documents. |
| Scores | `scores` | array[number] | The relevance score of the documents normalized between 0 and 1. |
</div>


Expand Down
10 changes: 5 additions & 5 deletions pkg/component/data/pinecone/v0/config/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
"instillUIOrder": 0,
"properties": {
"query": {
"description": "The query to rerank the documents",
"description": "The query to rerank the documents.",
"instillAcceptFormats": [
"string"
],
Expand All @@ -314,7 +314,7 @@
"type": "string"
},
"documents": {
"description": "The documents to rerank",
"description": "The documents to rerank.",
"instillUIOrder": 1,
"instillUpstreamTypes": [
"value",
Expand All @@ -328,7 +328,7 @@
"type": "array"
},
"top-n": {
"description": "The number of results to return sorted by relevance. Defaults to the number of inputs.\n\n",
"description": "The number of results to return sorted by relevance. Defaults to the number of inputs.",
"instillAcceptFormats": [
"integer"
],
Expand All @@ -352,15 +352,15 @@
"instillUIOrder": 0,
"properties": {
"documents": {
"description": "Reranked documents",
"description": "Reranked documents.",
"instillFormat": "array:string",
"items": {
"instillFormat": "string",
"title": "Documents",
"type": "string"
},
"instillUIOrder": 0,
"title": "Reranked documents",
"title": "Reranked documents.",
"type": "array"
},
"scores": {
Expand Down
1 change: 1 addition & 0 deletions pkg/component/data/pinecone/v0/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (r *rerankInput) asRequest() *rerankReq {
reqDocuments = append(reqDocuments, Document{Text: doc})
}

// TODO: make model configurable in tasks.json
return &rerankReq{
Model: "bge-reranker-v2-m3",
Query: r.Query,
Expand Down

0 comments on commit 2c808cf

Please sign in to comment.