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

Missing Export for Pinecone DB #38

Closed
JonahElbaz opened this issue Apr 25, 2024 · 5 comments
Closed

Missing Export for Pinecone DB #38

JonahElbaz opened this issue Apr 25, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@JonahElbaz
Copy link

JonahElbaz commented Apr 25, 2024

Seems like an export is missing to use Pinecone DB

ts-node src/ai
Error: Package subpath './dist/vectorDb/pinecone-db' is not defined by "exports" in /

Same with cache

Error: Package subpath './dist/cache/lmdb-cache' is not defined by "exports" 

Code

    const ragApplication = await new RAGApplicationBuilder()
      .setModel(new HuggingFace({ modelName: 'mistralai/Mixtral-8x7B-v0.1' }))
      .setVectorDb(new PineconeDb({
        projectName: 'test',
        namespace: 'dev',
        indexSpec: {
          pod: {
            podType: 'p1.x1',
            environment: 'us-east1-gcp',
          },
        },
      }))
      .setCache(new LmdbCache({ path: path.resolve('./cache') }))

      .addLoader(new SitemapLoader({ url: 'https://tesla-info.com/sitemap.xml' }))
      .setTemperature(0.01)
      .setSearchResultCount(100)
      .build();

The imports are structured like this (auto imported)

import { HuggingFace, RAGApplicationBuilder, SitemapLoader } from '@llm-tools/embedjs';

import { PineconeDb } from '@llm-tools/embedjs/dist/vectorDb/pinecone-db';
import { LmdbCache } from '@llm-tools/embedjs/dist/cache/lmdb-cache'

Partial Package.json

  "dependencies": {
    "@llm-tools/embedjs": "^0.0.67",
    "@mistralai/mistralai": "^0.1.3",
    "@pinecone-database/pinecone": "^2.2.0",

Let me know if you need more information to reproduce!

@JonahElbaz
Copy link
Author

Resolved by looking at the exports in package.json and altering the import. That being said, Typescript won't accept the import so I need to @ts-ignore it

// @ts-ignore
import { PineconeDb } from '@llm-tools/embedjs/vectorDb/pinecone';
// @ts-ignore
import { LmdbCache } from '@llm-tools/embedjs/cache/lmdb'

Otherwise I get
TS2307: Cannot find module @llm-tools/embedjs/cache/lmdb or its corresponding type declarations.

@adhityan
Copy link
Collaborator

adhityan commented Apr 26, 2024

This should not be the case. Look at the sample project written in TS -

EmbedJS Slack Bot

I have updated the documentation to make it clear what the import paths should be. For your TS error, could you share with me your tsconfig.json file and node version?

@adhityan adhityan added the bug Something isn't working label Apr 26, 2024
@JonahElbaz
Copy link
Author

Thanks for updating the documentation! Will definitely help others with future debugging if needed.

It's worth noting i'm in a monorepo so there might be an issue with that?

Heres my tsconfig (just using one from another project, so nothing really intentionally configured)

{
  "compilerOptions": {
    "module": "commonjs",
    "rootDir": ".",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "target": "es2020",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false,
    "allowJs": true
  },
  "include": [
    "src/**/*",
    "libs/**/*"
  ],
  "exclude": ["node_modules"]
}

Node Version: 20.12.0

@adhityan
Copy link
Collaborator

Thanks for sharing the tsconfig. Did this ever work for you since then? I haven't tested the library with monorepos yet but I suppose I can take a look - but it will take a bit.

@adhityan
Copy link
Collaborator

I am closing this issue for now, feel free to reopen it if issue persists. I am planning to move the library itself to a monorepo setup in some time, this should make things easier I suppose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants