Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LlamaIndexTS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
run-llama
LlamaIndexTS
Commits
5c4badbc
Unverified
Commit
5c4badbc
authored
7 months ago
by
Aaron Ji
Committed by
GitHub
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
chore: add 'late_chunking' for Jina embedding (#1223)
parent
2cd1383d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.changeset/yellow-donkeys-complain.md
+5
-0
5 additions, 0 deletions
.changeset/yellow-donkeys-complain.md
packages/llamaindex/src/embeddings/JinaAIEmbedding.ts
+11
-4
11 additions, 4 deletions
packages/llamaindex/src/embeddings/JinaAIEmbedding.ts
with
16 additions
and
4 deletions
.changeset/yellow-donkeys-complain.md
0 → 100644
+
5
−
0
View file @
5c4badbc
---
"
llamaindex"
:
patch
---
Extend JinaAPIEmbedding parameters
This diff is collapsed.
Click to expand it.
packages/llamaindex/src/embeddings/JinaAIEmbedding.ts
+
11
−
4
View file @
5c4badbc
...
@@ -20,8 +20,9 @@ export type JinaEmbeddingRequest = {
...
@@ -20,8 +20,9 @@ export type JinaEmbeddingRequest = {
input
:
Array
<
{
text
:
string
}
|
{
url
:
string
}
|
{
bytes
:
string
}
>
;
input
:
Array
<
{
text
:
string
}
|
{
url
:
string
}
|
{
bytes
:
string
}
>
;
model
?:
string
;
model
?:
string
;
encoding_type
?:
EncodingType
;
encoding_type
?:
EncodingType
;
task
_type
?:
TaskType
;
task
?:
TaskType
;
dimensions
?:
number
;
dimensions
?:
number
;
late_chunking
?:
boolean
;
};
};
export
type
JinaEmbeddingResponse
=
{
export
type
JinaEmbeddingResponse
=
{
...
@@ -44,9 +45,10 @@ export class JinaAIEmbedding extends MultiModalEmbedding {
...
@@ -44,9 +45,10 @@ export class JinaAIEmbedding extends MultiModalEmbedding {
apiKey
:
string
;
apiKey
:
string
;
model
:
string
;
model
:
string
;
baseURL
:
string
;
baseURL
:
string
;
task
Type
:
TaskType
|
undefined
;
task
?
:
TaskType
|
undefined
;
encodingType
?:
EncodingType
|
undefined
;
encodingType
?:
EncodingType
|
undefined
;
dimensions
?:
number
|
undefined
;
dimensions
?:
number
|
undefined
;
late_chunking
?:
boolean
|
undefined
;
async
getTextEmbedding
(
text
:
string
):
Promise
<
number
[]
>
{
async
getTextEmbedding
(
text
:
string
):
Promise
<
number
[]
>
{
const
result
=
await
this
.
getJinaEmbedding
({
input
:
[{
text
}]
});
const
result
=
await
this
.
getJinaEmbedding
({
input
:
[{
text
}]
});
...
@@ -87,8 +89,10 @@ export class JinaAIEmbedding extends MultiModalEmbedding {
...
@@ -87,8 +89,10 @@ export class JinaAIEmbedding extends MultiModalEmbedding {
this
.
model
=
init
?.
model
??
"
jina-embeddings-v3
"
;
this
.
model
=
init
?.
model
??
"
jina-embeddings-v3
"
;
this
.
baseURL
=
init
?.
baseURL
??
"
https://api.jina.ai/v1/embeddings
"
;
this
.
baseURL
=
init
?.
baseURL
??
"
https://api.jina.ai/v1/embeddings
"
;
init
?.
embedBatchSize
&&
(
this
.
embedBatchSize
=
init
?.
embedBatchSize
);
init
?.
embedBatchSize
&&
(
this
.
embedBatchSize
=
init
?.
embedBatchSize
);
this
.
task
Type
=
init
?.
task
Type
;
this
.
task
=
init
?.
task
;
this
.
encodingType
=
init
?.
encodingType
;
this
.
encodingType
=
init
?.
encodingType
;
this
.
dimensions
=
init
?.
dimensions
;
this
.
late_chunking
=
init
?.
late_chunking
;
}
}
private
async
getImageInput
(
private
async
getImageInput
(
...
@@ -125,8 +129,11 @@ export class JinaAIEmbedding extends MultiModalEmbedding {
...
@@ -125,8 +129,11 @@ export class JinaAIEmbedding extends MultiModalEmbedding {
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
model
:
this
.
model
,
model
:
this
.
model
,
encoding_type
:
this
.
encodingType
??
"
float
"
,
encoding_type
:
this
.
encodingType
??
"
float
"
,
...(
this
.
task
Type
&&
{
task
_type
:
this
.
task
Type
}),
...(
this
.
task
&&
{
task
:
this
.
task
}),
...(
this
.
dimensions
!==
undefined
&&
{
dimensions
:
this
.
dimensions
}),
...(
this
.
dimensions
!==
undefined
&&
{
dimensions
:
this
.
dimensions
}),
...(
this
.
late_chunking
!==
undefined
&&
{
late_chunking
:
this
.
late_chunking
,
}),
...
params
,
...
params
,
}),
}),
});
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment