-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from n4ze3m/next
v1.4.3
- Loading branch information
Showing
10 changed files
with
147 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { PrismaClient } from "@prisma/client"; | ||
const prisma = new PrismaClient(); | ||
|
||
const MODELS = [ | ||
{ | ||
name: "Claude 2.1 (Anthropic)", | ||
model_id: "claude-2.1-dbase", | ||
model_type: "chat", | ||
model_provider: "Anthropic", | ||
stream_available: true, | ||
local_model: false, | ||
config: "{}", | ||
}, | ||
{ | ||
name: "Claude Instant 1.2 (Anthropic)", | ||
model_id: "claude-instant-1.2-dbase", | ||
model_type: "chat", | ||
model_provider: "Anthropic", | ||
stream_available: true, | ||
local_model: false, | ||
config: "{}", | ||
}, | ||
]; | ||
|
||
const newModels = async () => { | ||
console.log("Seeding new models..."); | ||
for (const model of MODELS) { | ||
await prisma.dialoqbaseModels.upsert({ | ||
where: { | ||
model_id: model.model_id, | ||
}, | ||
update: {}, | ||
create: model, | ||
}); | ||
} | ||
}; | ||
|
||
const main = async () => { | ||
await newModels(); | ||
}; | ||
|
||
main() | ||
.then(async () => { | ||
await prisma.$disconnect(); | ||
}) | ||
.catch(async (e) => { | ||
console.error(e); | ||
await prisma.$disconnect(); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { BufferLoader } from "langchain/document_loaders/fs/buffer"; | ||
import { Document } from "langchain/document"; | ||
import * as mammoth from "mammoth"; | ||
|
||
export class DialoqbaseDocxLoader extends BufferLoader { | ||
constructor(filePathOrBlob: string | Blob) { | ||
super(filePathOrBlob); | ||
} | ||
|
||
public async parse( | ||
raw: Buffer, | ||
metadata: Document["metadata"] | ||
): Promise<Document[]> { | ||
const data = await mammoth.extractRawText({ buffer: raw }); | ||
const text = data.value; | ||
const meta = { source: this.filePathOrBlob }; | ||
if (text) { | ||
return [new Document({ pageContent: text, metadata: meta })]; | ||
} | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters