Skip to content

Commit

Permalink
update dependencies (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored Apr 22, 2024
1 parent a0649f2 commit 61b3495
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 71 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@effect/experimental": "^0.15.5",
"@effect/opentelemetry": "^0.32.3",
"@effect/platform": "^0.50.0",
"@effect/platform-node": "^0.47.0",
"@effect/schema": "^0.66.3",
"@effect/experimental": "^0.15.8",
"@effect/opentelemetry": "^0.33.0",
"@effect/platform": "^0.50.3",
"@effect/platform-node": "^0.47.3",
"@effect/schema": "^0.66.6",
"@opentelemetry/exporter-metrics-otlp-http": "^0.50.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0",
"@opentelemetry/sdk-metrics": "^1.23.0",
"@opentelemetry/sdk-trace-base": "^1.23.0",
"@opentelemetry/sdk-trace-node": "^1.23.0",
"dfx": "^0.93.0",
"dfx": "^0.94.0",
"dotenv": "^16.4.5",
"effect": "3.0.3",
"gpt-tokenizer": "^2.1.2",
"html-entities": "^2.5.2",
"octokit": "^3.2.0",
"openai": "^4.38.1",
"openai": "^4.38.2",
"prettier": "^3.2.5"
}
}
108 changes: 54 additions & 54 deletions pnpm-lock.yaml

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

6 changes: 2 additions & 4 deletions src/AutoThreads.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Schema, TreeFormatter } from "@effect/schema"
import { ChannelsCache } from "bot/ChannelsCache"
import { OpenAI, OpenAIError, OpenAITool } from "bot/OpenAI"
import { OpenAI, OpenAIFn } from "bot/OpenAI"
import { LayerUtils } from "bot/_common"
import * as Str from "bot/utils/String"
import { Discord, DiscordREST, Ix, Perms, UI } from "dfx"
Expand All @@ -10,8 +10,6 @@ import {
InteractionsRegistry,
} from "dfx/gateway"
import {
Cause,
Console,
Context,
Data,
Duration,
Expand Down Expand Up @@ -54,7 +52,7 @@ class MessageInfo extends Schema.Class<MessageInfo>("MessageInfo")({
}
}

const messageInfo = new OpenAITool(
const messageInfo = new OpenAIFn(
"message_info",
"Extract a short title and validate a message",
MessageInfo,
Expand Down
10 changes: 4 additions & 6 deletions src/OpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ const ChoiceToolCall = <A, I>(
}),
})

export class OpenAITool<A> {
export class OpenAIFn<A> {
constructor(
readonly name: string,
readonly description: string,
readonly schema: Schema.Schema<A, any> & {
readonly fields: Record<string, Schema.Schema<any, any>>
},
readonly schema: Schema.Schema<A, any>,
) {
this.jsonSchema = JSONSchema.make(Schema.Struct(schema.fields)) as any
this.jsonSchema = JSONSchema.make(schema) as any
this.choiceSchema = ChoiceToolCall(name, schema)
}

Expand Down Expand Up @@ -125,7 +123,7 @@ const make = (params: {
Effect.withSpan("OpenAI.call"),
)

const fn = <A>(tool: OpenAITool<A>, prompt: string) =>
const fn = <A>(tool: OpenAIFn<A>, prompt: string) =>
call((_, signal) =>
_.chat.completions.create(
{
Expand Down

0 comments on commit 61b3495

Please sign in to comment.