Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
cfortuner committed Oct 28, 2024
2 parents 554c398 + 955d3ae commit ad185f4
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/abort-chat-completion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import 'dotenv/config';

<<<<<<< HEAD
import { ChatModel, type Msg, MsgUtil } from '../src/index.js';
=======
import { ChatModel, type Msg, MsgUtil } from '@dexaai/dexter';
>>>>>>> origin/master

/**
* npx tsx examples/abort-chat-completion.ts
Expand Down
4 changes: 4 additions & 0 deletions examples/ai-function.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import 'dotenv/config';

<<<<<<< HEAD
=======
import { ChatModel, createAIFunction, type Msg, MsgUtil } from '@dexaai/dexter';
>>>>>>> origin/master
import { z } from 'zod';

import {
Expand Down
5 changes: 5 additions & 0 deletions examples/ai-runner-with-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import {
createAIFunction,
createAIRunner,
MsgUtil,
<<<<<<< HEAD
} from '../src/index.js';
=======
} from '@dexaai/dexter';
import { z } from 'zod';
>>>>>>> origin/master

/** Get the weather for a given location. */
const getWeather = createAIFunction(
Expand Down
5 changes: 5 additions & 0 deletions examples/ai-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import {
createAIFunction,
createAIRunner,
MsgUtil,
<<<<<<< HEAD
} from '../src/index.js';
=======
} from '@dexaai/dexter';
import { z } from 'zod';
>>>>>>> origin/master

/** Get the weather for a given location. */
const getWeather = createAIFunction(
Expand Down
4 changes: 4 additions & 0 deletions examples/caching-redis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import 'dotenv/config';

<<<<<<< HEAD
=======
import { EmbeddingModel } from '@dexaai/dexter';
>>>>>>> origin/master
import KeyvRedis from '@keyv/redis';
import Keyv from 'keyv';

Expand Down
4 changes: 4 additions & 0 deletions examples/extract-people-names.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import 'dotenv/config';

<<<<<<< HEAD
=======
import { ChatModel, createExtractFunction } from '@dexaai/dexter';
>>>>>>> origin/master
import { z } from 'zod';

import { ChatModel, createExtractFunction } from '../src/index.js';
Expand Down
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"name": "@dexaai/dexter",
"type": "module",
<<<<<<< HEAD
"version": "4.0.0-1",
=======
"version": "4.0.0",
>>>>>>> origin/master
"description": "LLM tools used in production at Dexa, with a focus on real-world RAG.",
"repository": "dexaai/dexter",
"license": "MIT",
Expand Down Expand Up @@ -49,8 +53,12 @@
"hash-object": "^5.0.1",
"jsonrepair": "^3.8.1",
"ky": "^1.7.2",
<<<<<<< HEAD
"ai-fetch": "../ai-fetch",
"openai-fetch": "../openai-fetch",
=======
"openai-fetch": "3.3.1",
>>>>>>> origin/master
"openai-zod-to-json-schema": "^1.0.3",
"p-map": "^7.0.2",
"p-throttle": "^6.2.0",
Expand Down
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/ai-function/ai-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ export function createAIRunner<Content = string>(args: {
function getParams(args: {
functions?: AIFunction[];
mode: AIRunner.Mode;
<<<<<<< HEAD
}): Pick<Model.Chat.Config<Model.Chat.Client>, 'functions' | 'tools'> {
=======
}): Pick<Model.Chat.Config, 'functions' | 'tools'> {
>>>>>>> origin/master
const { functions } = args;
// Return an empty object if there are no functions
if (!functions?.length) {
Expand Down
8 changes: 8 additions & 0 deletions src/ai-function/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type AIRunner<Content = string> = (
) => Promise<AIRunner.Response<Content>>;

export namespace AIRunner {
<<<<<<< HEAD
export type Client = any;

/** Parameters to execute a runner */
Expand All @@ -25,6 +26,13 @@ export namespace AIRunner {
Model.Chat.Run & Model.Chat.Config<Client>,
'messages' | 'functions' | 'tools'
>
=======
/** Parameters to execute a runner */
export type Params = SetOptional<Model.Chat.Run & Model.Chat.Config, 'model'>;

export type ModelParams = Partial<
Omit<Model.Chat.Run & Model.Chat.Config, 'messages' | 'functions' | 'tools'>
>>>>>>> origin/master
>;

/** Response from executing a runner */
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export {
export { createExtractFunction } from './extract/index.js';
export type { ChatModelArgs } from './model/chat.js';
export { ChatModel } from './model/chat.js';
<<<<<<< HEAD
export { createAnthropicClient } from './model/clients/anthropic.js';
=======
>>>>>>> origin/master
export { createOpenAIClient } from './model/clients/openai.js';
export type { CompletionModelArgs } from './model/completion.js';
export { CompletionModel } from './model/completion.js';
Expand Down
3 changes: 3 additions & 0 deletions src/model/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* eslint-disable no-use-before-define */
import {
<<<<<<< HEAD
type AIChatClient,
type AICompletionClient,
type AIEmbeddingClient,
=======
>>>>>>> origin/master
type ChatParams,
type ChatResponse,
type ChatStreamResponse,
Expand Down

0 comments on commit ad185f4

Please sign in to comment.