Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.9.2 #57

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alkemio/space-ingest",
"version": "0.9.1",
"version": "0.9.2",
"description": "",
"author": "Alkemio Foundation",
"private": true,
Expand Down
24 changes: 11 additions & 13 deletions src/callout.handlers/base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from 'winston';
import { Callout, CalloutContribution } from '../generated/graphql';
import { Callout } from '../generated/graphql';
import { Document } from 'langchain/document';
import generateDocument from '../generate.document';

Expand Down Expand Up @@ -49,15 +49,14 @@ export const baseHandler = async (
];

logger.info(`Generating documents for Callout (${documentId}) contributions`);
// extra loop but will do for now
callout.contributions
?.map((contribution: Partial<CalloutContribution>) => {
let docLike;
if (!!contribution.link) {
docLike = contribution.link;
} else if (!!contribution.post) {
docLike = contribution.post;
}
for (const contribution of callout.contributions || []) {
let docLike;
if (contribution.link) {
docLike = contribution.link;
} else if (contribution.post) {
docLike = contribution.post;
}
if (docLike) {
const { pageContent, documentId, source, type, title } =
generateDocument(docLike);
result.push(
Expand All @@ -71,9 +70,8 @@ export const baseHandler = async (
},
})
);
})
.join('\n');

}
}
logger.info(
`Documents for Callout (${documentId}) generated. # of documents ${result.length}`
);
Expand Down
9 changes: 8 additions & 1 deletion src/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ export default async (
);
const response = await openAi.getEmbeddings(deployment, batch);
data = [...data, ...response.data];
logger.info('Embeddings generates');
logger.debug(
`Generated embeddings ${
response.data.length
}; Embeddings length are: ${Array.from(
new Set(response.data.map(({ embedding }) => embedding.length))
)}`
);
logger.info('Embeddings generated.');
} catch (error) {
logger.error({
...(error as Error),
Expand Down
Loading