langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

Move code into langchain/src

Open nfcampos opened this issue 1 year ago • 6 comments

@sullivan-sean what do you think? The current setup makes the tsconfig "invalid" after yarn build is run, because of the generated top-level entrypoints, if we could scope tsconfig to src/ would be easier?

nfcampos avatar Feb 18 '23 07:02 nfcampos

The generated entrypoints should all be .js or .d.ts, can we just ignore those in the tsconfig? Open to introducing src too but I like having things not too deeply nested.

sullivan-sean avatar Feb 19 '23 00:02 sullivan-sean

I tried that, but it didn't fix it

nfcampos avatar Feb 19 '23 06:02 nfcampos

Can we actually move to a monorepo structure with turborepo & pnpm with that I believe we can solve the tree shaking much more smartly for edge code.

Necmttn avatar Feb 20 '23 00:02 Necmttn

We're currently using turborepo and have multiple yarn workspaces in the monorepo as it stands -- is there anything more you'd like to see besides pnpm in place of yarn?

sullivan-sean avatar Feb 20 '23 02:02 sullivan-sean

Oh sorry didn't notice the turbo.json as it's a bit of an odd structure right now IMO. perhaps my main point is breaking every service to it's own package.json to be able to isolate it's deps.

so community prs adding new functionality with it's deps won't make pnpm add langchain adding 3 gb node_modules more modular

Necmttn avatar Feb 20 '23 03:02 Necmttn

Oh yeah! Right now we're including any optional external modules in peerDepedencies with peerDependencyMeta set to optional. This makes sure things like openai aren't installed unless the consuming package installs it alongside langchain.

I don't think langchain should be adding anywhere near 3gb of node_modules (I just installed in an empty project and it's about 3.5 mb)

sullivan-sean avatar Feb 20 '23 04:02 sullivan-sean

Done in #124

nfcampos avatar Feb 27 '23 19:02 nfcampos