Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3",
"weaviate-client": "~3.2.2"
"weaviate-client": "~3.5.1"
},
"jest": {
"moduleFileExtensions": [
Expand Down
4 changes: 2 additions & 2 deletions backend/src/multimodal/multimodal-setup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class MultimodalSetupService {
const client = await this.getClient()
const myMedia = client.collections.get('MyMedia')

let objectsToInsert = []
let objectsToInsert = .collections.use

for (let imgfile of imageFiles) {
// construct image objects to insert
Expand Down Expand Up @@ -128,7 +128,7 @@ export class MultimodalSetupService {
const client = this.getClient()
const myMedia = (await client).collections.get('MyMedia')

for (let file of videoFiles) {
for (let file of videoFiles) {.collections.use
// construct image objects to insert
const itemToInsert = {
name: file.name,
Expand Down
8 changes: 4 additions & 4 deletions backend/src/multimodal/multimodal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class MultimodalService {
async searchWithText(query: string) {
const client = await this.getClient()

// get collection 'MyMedia'
// get collection 'MyM.collections.use
const gallery = client.collections.get<MediaObject>('MyMedia')

// nearText search
Expand All @@ -64,7 +64,7 @@ export class MultimodalService {
}


async searchWithImage(b64Image: string) {
async searchWithImage(b64I.collections.use
const client = await this.getClient()

const gallery = client.collections.get('MyMedia')
Expand All @@ -74,7 +74,7 @@ export class MultimodalService {
})
}

async searchWithVideo(b64Video: string) {
async searchWithVideo(b64V.collections.use
const client = await this.getClient()

const gallery = client.collections.get('MyMedia')
Expand All @@ -84,7 +84,7 @@ export class MultimodalService {
returnMetadata: ['distance'],
})
}

.collections.use
async searchWithVideoFile(file: any) {
const client = await this.getClient()

Expand Down
8 changes: 4 additions & 4 deletions backend/src/search/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export class WeaviateSearchService {

async semanticSearch(query) {
const client = await this.getClient();
const wiki = client.collections.get('Wikipedia')
const wiki = client.collections.use('Wikipedia')

// return wiki.query.nearText(query, { limit: 5 })
return wiki.query.nearText(query, { limit: 5, returnMetadata: [ 'distance' ] })
}

async hybridSearch(query) {
const client = await this.getClient();
const wiki = client.collections.get('Wikipedia')
const wiki = client.collections.use('Wikipedia')

return wiki.query.hybrid(query, {
alpha: 0.7,
Expand All @@ -66,7 +66,7 @@ export class WeaviateSearchService {

async rag(query) {
const client = await this.getClient();
const wiki = client.collections.get('Wikipedia')
const wiki = client.collections.use('Wikipedia')

const prompts = {
singlePrompt: 'translate {title} to German',
Expand All @@ -82,7 +82,7 @@ export class WeaviateSearchService {

async ragDynamic(query, singlePrompt, groupedTask) {
const client = await this.getClient();
const wiki = client.collections.get('Wikipedia')
const wiki = client.collections.use('Wikipedia')

let prompts = {};
if(singlePrompt)
Expand Down
6 changes: 3 additions & 3 deletions backend/src/setup/setup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class WeaviateSetupService {
const filePath = join(process.cwd(), `./files/${fileName}`)
const file = readline.createInterface({ input: fs.createReadStream(filePath), output: process.stdout, terminal: false });

const wiki = client.collections.get(collectionName)
const wiki = client.collections.use(collectionName)
let itemsToInsert = []
let counter = 0;

Expand Down Expand Up @@ -143,7 +143,7 @@ export class WeaviateSetupService {
let itemsToInsert = []
let counter = 0;

const wiki = client.collections.get(collectionName)
const wiki = client.collections.use(collectionName)
for await (const line of file) {
counter++;
if(counter % 1000 == 0)
Expand Down Expand Up @@ -195,7 +195,7 @@ export class WeaviateSetupService {
public async getCollectionCount(collectionName) {
const client = await this.getClient();

const wiki = client.collections.get(collectionName)
const wiki = client.collections.use(collectionName)
return wiki.aggregate.overAll()
}

Expand Down