Skip to content

Commit

Permalink
feat(galileo-cli): document upload external module switch to async load
Browse files Browse the repository at this point in the history
  • Loading branch information
sperka committed Nov 1, 2023
1 parent f0d51a3 commit 44940db
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 107 deletions.
194 changes: 92 additions & 102 deletions demo/corpus/embeddings/poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/galileo-cli/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ In your script, you need to import `DocumentMetadata` and `IMetadataProvider` fr
import { DocumentMetadata, IMetadataProvider } from "../../src"; // or, later: ... from "@aws-galileo/cli"

export class MetadataProvider implements IMetadataProvider {
getMetadata(): string | DocumentMetadata {
async getMetadata(): Promise<string | DocumentMetadata> {

// option 1:
const metadataFile: string = ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { parseCsv } from "./parser-common";
import { DocumentMetadata, IMetadataProvider } from "../../src";

export class MetadataProvider implements IMetadataProvider {
getMetadata(): string | DocumentMetadata {
async getMetadata(): Promise<string | DocumentMetadata> {
// build the metadata
const docMetadata = parseCsv();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { parseCsv } from "./parser-common";
import { DocumentMetadata, IMetadataProvider } from "../../src";

export class MetadataProvider implements IMetadataProvider {
getMetadata(): string | DocumentMetadata {
async getMetadata(): Promise<string | DocumentMetadata> {
// build the metadata
const docMetadata = parseCsv();

Expand Down
2 changes: 1 addition & 1 deletion packages/galileo-cli/src/lib/document/document-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const loadDocumentMetadata = async (
const { MetadataProvider } = await import(loaderOrMetaFilePath);
const metadataProvider: IMetadataProvider = new MetadataProvider();

const metadataReturned = metadataProvider.getMetadata();
const metadataReturned = await metadataProvider.getMetadata();

if (typeof metadataReturned === "string") {
metadataFile = metadataReturned;
Expand Down
2 changes: 1 addition & 1 deletion packages/galileo-cli/src/lib/document/metadata-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ PDX-License-Identifier: Apache-2.0 */
import { DocumentMetadata } from "../types";

export interface IMetadataProvider {
readonly getMetadata: () => string | DocumentMetadata;
readonly getMetadata: () => Promise<string | DocumentMetadata>;
}

0 comments on commit 44940db

Please sign in to comment.