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
22127934
Commit
22127934
authored
1 year ago
by
Yi Ding
Browse files
Options
Downloads
Patches
Plain Diff
more housekeeping
parent
d6c6aefd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/core/src/Embedding.ts
+3
-15
3 additions, 15 deletions
packages/core/src/Embedding.ts
packages/core/src/NodeParser.ts
+1
-1
1 addition, 1 deletion
packages/core/src/NodeParser.ts
packages/core/src/ResponseSynthesizer.ts
+1
-0
1 addition, 0 deletions
packages/core/src/ResponseSynthesizer.ts
with
5 additions
and
16 deletions
packages/core/src/Embedding.ts
+
3
−
15
View file @
22127934
...
...
@@ -174,24 +174,12 @@ export function getTopKMMREmbeddings(
}
export
abstract
class
BaseEmbedding
{
static
similarity
(
similarity
(
embedding1
:
number
[],
embedding2
:
number
[],
mode
:
SimilarityType
=
SimilarityType
.
D
OT_PRODUC
T
mode
:
SimilarityType
=
SimilarityType
.
D
EFAUL
T
):
number
{
if
(
embedding1
.
length
!==
embedding2
.
length
)
{
throw
new
Error
(
"
Embedding length mismatch
"
);
}
if
(
mode
===
SimilarityType
.
DOT_PRODUCT
)
{
let
result
=
0
;
for
(
let
i
=
0
;
i
<
embedding1
.
length
;
i
++
)
{
result
+=
embedding1
[
i
]
*
embedding2
[
i
];
}
return
result
;
}
else
{
throw
new
Error
(
"
Not implemented yet
"
);
}
return
similarity
(
embedding1
,
embedding2
,
mode
);
}
abstract
aGetTextEmbedding
(
text
:
string
):
Promise
<
number
[]
>
;
...
...
This diff is collapsed.
Click to expand it.
packages/core/src/NodeParser.ts
+
1
−
1
View file @
22127934
...
...
@@ -19,7 +19,7 @@ export function getNodesFromDocument(
const
textSplits
=
getTextSplitsFromDocument
(
document
,
textSplitter
);
textSplits
.
forEach
((
textSplit
,
index
)
=>
{
textSplits
.
forEach
((
textSplit
)
=>
{
const
node
=
new
TextNode
({
text
:
textSplit
});
node
.
relationships
[
NodeRelationship
.
SOURCE
]
=
document
.
asRelatedNodeInfo
();
nodes
.
push
(
node
);
...
...
This diff is collapsed.
Click to expand it.
packages/core/src/ResponseSynthesizer.ts
+
1
−
0
View file @
22127934
...
...
@@ -182,6 +182,7 @@ export function getResponseBuilder(): BaseResponseBuilder {
return
new
SimpleResponseBuilder
();
}
// TODO replace with Logan's new response_sythesizers/factory.py
export
class
ResponseSynthesizer
{
responseBuilder
:
BaseResponseBuilder
;
...
...
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