Skip to content

Commit

Permalink
Upgrade to latest ESLint config and fix errors (#50)
Browse files Browse the repository at this point in the history
* Upgrade to latest ESLint config and fix errors

* Fix TS error in examples
  • Loading branch information
rileytomasek authored Oct 13, 2024
1 parent e2b78f7 commit 3f88f13
Show file tree
Hide file tree
Showing 64 changed files with 503 additions and 986 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: ['@dexaai/eslint-config', '@dexaai/eslint-config/node'],
ignorePatterns: ['.next/', 'dist/', 'node_modules/'],
extends: ['@dexaai/eslint-config/node'],
ignorePatterns: ['.next/', 'dist/', 'node_modules/', 'docs/'],
rules: {
'@typescript-eslint/naming-convention': 'off',
'no-console': 'off',
},
};
1 change: 1 addition & 0 deletions examples/abort-chat-completion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dotenv/config';

import { ChatModel, Msg, type Prompt } from '@dexaai/dexter';

/**
Expand Down
3 changes: 2 additions & 1 deletion examples/ai-function.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dotenv/config';
import { z } from 'zod';

import { ChatModel, createAIFunction, Msg, type Prompt } from '@dexaai/dexter';
import { z } from 'zod';

/**
* npx tsx examples/ai-function.ts
Expand Down
5 changes: 3 additions & 2 deletions examples/ai-runner-with-error.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import 'dotenv/config';
import { z } from 'zod';

import {
ChatModel,
Msg,
createAIFunction,
createAIRunner,
Msg,
} from '@dexaai/dexter';
import { z } from 'zod';

/** Get the weather for a given location. */
const getWeather = createAIFunction(
Expand Down
5 changes: 3 additions & 2 deletions examples/ai-runner.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import 'dotenv/config';
import { z } from 'zod';

import {
ChatModel,
Msg,
createAIFunction,
createAIRunner,
Msg,
} from '@dexaai/dexter';
import { z } from 'zod';

/** Get the weather for a given location. */
const getWeather = createAIFunction(
Expand Down
3 changes: 2 additions & 1 deletion examples/basic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dotenv/config';
import { EmbeddingModel } from '@dexaai/dexter/model';

import { PineconeDatastore } from '@dexaai/dexter/datastore/pinecone';
import { EmbeddingModel } from '@dexaai/dexter/model';

/**
* npx tsx examples/basic.ts
Expand Down
1 change: 1 addition & 0 deletions examples/caching-redis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dotenv/config';

import { EmbeddingModel } from '@dexaai/dexter/model';
import KeyvRedis from '@keyv/redis';
import Keyv from 'keyv';
Expand Down
4 changes: 2 additions & 2 deletions examples/caching.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dotenv/config';
import { EmbeddingModel } from '@dexaai/dexter/model';

import { PineconeDatastore } from '@dexaai/dexter/datastore/pinecone';
import { EmbeddingModel } from '@dexaai/dexter/model';
import QuickLRU from 'quick-lru';

/**
Expand All @@ -21,7 +22,6 @@ async function main() {
// Pinecone datastore with cache
const store = new PineconeDatastore<{ content: string }>({
contentKey: 'content',
// @ts-ignore
embeddingModel,
events: { onQueryComplete: [console.log] },
cache: new Map(),
Expand Down
3 changes: 2 additions & 1 deletion examples/chatbot/answer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type Prompt, Msg } from '@dexaai/dexter/prompt';
import { Msg, type Prompt } from '@dexaai/dexter/prompt';

import { chatModel, chunkDatastore } from './tools.js';

const system = Msg.system(`
Expand Down
5 changes: 4 additions & 1 deletion examples/chatbot/cli.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'dotenv/config';

import readline from 'node:readline';
import type { Prompt } from '@dexaai/dexter/prompt';

import { type Prompt } from '@dexaai/dexter/prompt';

import { generateAnswer } from './answer.js';

const history: Prompt.Msg[] = [];
Expand Down
4 changes: 3 additions & 1 deletion examples/chatbot/ingest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'dotenv/config';

import { readFile } from 'node:fs/promises';
import { chunkDatastore, type Chunk } from './tools.js';

import { type Chunk, chunkDatastore } from './tools.js';

async function main() {
const chunks = await loadChunks();
Expand Down
3 changes: 2 additions & 1 deletion examples/chatbot/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import {
EmbeddingModel,
SparseVectorModel,
} from '@dexaai/dexter/model';
import { type JsonObject } from 'type-fest';

export interface Chunk {
export interface Chunk extends JsonObject {
chunkId: string;
chunkTitle: string;
episodeTitle: string;
Expand Down
3 changes: 2 additions & 1 deletion examples/extract-people-names.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dotenv/config';
import { z } from 'zod';

import { ChatModel, createAIExtractFunction } from '@dexaai/dexter';
import { z } from 'zod';

/** A function to extract people names from text. */
const extractPeopleNamesRunner = createAIExtractFunction({
Expand Down
1 change: 1 addition & 0 deletions examples/with-telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import './instrument.js';
import 'dotenv/config';

import { ChatModel } from '@dexaai/dexter';
import * as Sentry from '@sentry/node';

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"zod-validation-error": "^3.4.0"
},
"devDependencies": {
"@dexaai/eslint-config": "^0.4.0",
"@dexaai/eslint-config": "^1.3.6",
"@sentry/node": "^8.34.0",
"@types/node": "^20.14.11",
"dotenv-cli": "^7.4.2",
Expand Down
Loading

0 comments on commit 3f88f13

Please sign in to comment.