Skip to content

Commit

Permalink
fix(updateNode): fix empty string embeddings bug
Browse files Browse the repository at this point in the history
  • Loading branch information
danlannan777 committed Apr 15, 2024
1 parent 3975da7 commit 5ea5538
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/functions/updateNodeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const updateNodeFactory = <
nextNodeProperties[key as keyof TypeOf<PD>] !== null &&
nextNodeProperties[key as keyof TypeOf<PD>] !== ''
)
const embeddingsMap = embeddingsDefinitionKeys && await openai.embeddings.create({
const embeddingsMap = embeddingsDefinitionKeys && embeddingsDefinitionKeys.length && await openai.embeddings.create({
model: embeddingsModel,
input: embeddingsDefinitionKeys.map((key) => {
const { contextPointer, gptModel } = embeddingsDefinition[key as keyof typeof embeddingsDefinition]!
Expand Down
8 changes: 6 additions & 2 deletions src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ const {
})


const newJobNode = await createNode('Company', {
'companyName': 'Blueprint2',
const companyNode = await createNode('Company', {
'companyName': 'Blueprint6',
})
const out = await updateNode('Company', companyNode!.nodeId, {
'logo': 'https://fdsfsd.com',
'shortDescription': ''
})
// console.log(newJobNode)
// const updatedNode = await updateNode('Job', newJobNode!.nodeId, (nodeState) => {
Expand Down

0 comments on commit 5ea5538

Please sign in to comment.