From cb43a30e97a5ce190560492470e453439abb7a13 Mon Sep 17 00:00:00 2001 From: "J. Brandon Johnson" Date: Wed, 15 Jan 2025 06:28:05 -0800 Subject: [PATCH] chore: update with develop branch --- packages/core/src/defaultCharacter.ts | 2 +- packages/core/src/parsing.ts | 1 - packages/core/src/types.ts | 18 ++ packages/core/src/uuid.ts | 7 - .../plugin-node/src/services/transcription.ts | 13 +- packages/plugin-node/src/services/video.ts | 2 +- pnpm-lock.yaml | 197 +++--------------- 7 files changed, 54 insertions(+), 186 deletions(-) diff --git a/packages/core/src/defaultCharacter.ts b/packages/core/src/defaultCharacter.ts index 78e507e36e..8faaa64f2b 100644 --- a/packages/core/src/defaultCharacter.ts +++ b/packages/core/src/defaultCharacter.ts @@ -5,7 +5,7 @@ export const defaultCharacter: Character = { username: "eliza", plugins: [], clients: [], - modelProvider: ModelProviderName.ANTHROPIC, + modelProvider: ModelProviderName.LLAMALOCAL, settings: { secrets: {}, voice: { diff --git a/packages/core/src/parsing.ts b/packages/core/src/parsing.ts index ebe3e27b4e..331cd30a13 100644 --- a/packages/core/src/parsing.ts +++ b/packages/core/src/parsing.ts @@ -151,7 +151,6 @@ export function parseJSONObjectFromText( jsonData = JSON.parse(objectMatch[0]); } catch (e) { console.error("Error parsing JSON:", e); - console.log("text", text); return null; } } diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 313aa5fb1f..621ffe81c6 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -1278,6 +1278,22 @@ export interface IImageDescriptionService extends Service { ): Promise<{ title: string; description: string }>; } +export interface ITranscriptionService extends Service { + transcribeAttachment(audioBuffer: ArrayBuffer): Promise; + transcribeAttachmentLocally( + audioBuffer: ArrayBuffer + ): Promise; + transcribe(audioBuffer: ArrayBuffer): Promise; + transcribeLocally(audioBuffer: ArrayBuffer): Promise; +} + +export interface IVideoService extends Service { + isVideoUrl(url: string): boolean; + fetchVideoInfo(url: string): Promise; + downloadVideo(videoInfo: Media): Promise; + processVideo(url: string, runtime: IAgentRuntime): Promise; +} + export interface ITextGenerationService extends Service { initializeModel(): Promise; queueMessageCompletion( @@ -1404,6 +1420,8 @@ export interface ITeeLogService extends Service { export enum ServiceType { IMAGE_DESCRIPTION = "image_description", + TRANSCRIPTION = "transcription", + VIDEO = "video", TEXT_GENERATION = "text_generation", BROWSER = "browser", SPEECH_GENERATION = "speech_generation", diff --git a/packages/core/src/uuid.ts b/packages/core/src/uuid.ts index 7c0b831c8a..dee5decfff 100644 --- a/packages/core/src/uuid.ts +++ b/packages/core/src/uuid.ts @@ -18,13 +18,6 @@ export function stringToUuid(target: string | number): UUID { throw TypeError("Value must be string"); } - // Return early if string already matches UUID format - const uuidRegex = - /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; - if (uuidRegex.test(target)) { - return target as UUID; - } - const _uint8ToHex = (ubyte: number): string => { const first = ubyte >> 4; const second = ubyte - (first << 4); diff --git a/packages/plugin-node/src/services/transcription.ts b/packages/plugin-node/src/services/transcription.ts index 5627f86f06..49451dfa3d 100644 --- a/packages/plugin-node/src/services/transcription.ts +++ b/packages/plugin-node/src/services/transcription.ts @@ -1,11 +1,13 @@ +import { createClient, DeepgramClient } from "@deepgram/sdk"; import { elizaLogger, IAgentRuntime, ITranscriptionService, + Service, + ServiceType, settings, TranscriptionProvider, } from "@elizaos/core"; -import { Service, ServiceType } from "@elizaos/core"; import { exec } from "child_process"; import { File } from "formdata-node"; import fs from "fs"; @@ -15,7 +17,6 @@ import os from "os"; import path from "path"; import { fileURLToPath } from "url"; import { promisify } from "util"; -import { createClient, DeepgramClient } from "@deepgram/sdk"; // const __dirname = path.dirname(new URL(import.meta.url).pathname); #compatibility issues with windows const __filename = fileURLToPath(import.meta.url); @@ -356,7 +357,9 @@ export class TranscriptionService await this.saveDebugAudio(audioBuffer, "openai_input_original"); const arrayBuffer = new Uint8Array(audioBuffer).buffer; - const convertedBuffer = Buffer.from(await this.convertAudio(arrayBuffer)).buffer; + const convertedBuffer = Buffer.from( + await this.convertAudio(arrayBuffer) + ).buffer; await this.saveDebugAudio( convertedBuffer, @@ -409,7 +412,9 @@ export class TranscriptionService await this.saveDebugAudio(audioBuffer, "local_input_original"); const arrayBuffer = new Uint8Array(audioBuffer).buffer; - const convertedBuffer = Buffer.from(await this.convertAudio(arrayBuffer)).buffer; + const convertedBuffer = Buffer.from( + await this.convertAudio(arrayBuffer) + ).buffer; await this.saveDebugAudio(convertedBuffer, "local_input_converted"); diff --git a/packages/plugin-node/src/services/video.ts b/packages/plugin-node/src/services/video.ts index 8efe36a62b..2807911e11 100644 --- a/packages/plugin-node/src/services/video.ts +++ b/packages/plugin-node/src/services/video.ts @@ -1,4 +1,5 @@ import { + elizaLogger, IAgentRuntime, ITranscriptionService, IVideoService, @@ -6,7 +7,6 @@ import { Service, ServiceType, stringToUuid, - elizaLogger, } from "@elizaos/core"; import ffmpeg from "fluent-ffmpeg"; import fs from "fs"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4a1780ff41..7de6868959 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -721,6 +721,9 @@ importers: '@elizaos/core': specifier: workspace:* version: link:../core + '@elizaos/plugin-birdeye': + specifier: workspace:* + version: link:../plugin-birdeye '@types/body-parser': specifier: 1.19.5 version: 1.19.5 @@ -1115,9 +1118,6 @@ importers: '@solana/web3.js': specifier: 1.95.8 version: 1.95.8(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@tavily/core': - specifier: ^0.0.2 - version: 0.0.2 '@types/fluent-ffmpeg': specifier: 2.1.27 version: 2.1.27 @@ -22934,7 +22934,7 @@ snapshots: '@acuminous/bitsyntax@0.1.2': dependencies: buffer-more-ints: 1.0.0 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) safe-buffer: 5.1.2 transitivePeerDependencies: - supports-color @@ -24187,7 +24187,7 @@ snapshots: '@babel/traverse': 7.26.5 '@babel/types': 7.26.5 convert-source-map: 2.0.0 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -24967,7 +24967,7 @@ snapshots: '@babel/parser': 7.26.5 '@babel/template': 7.25.9 '@babel/types': 7.26.5 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -25120,7 +25120,7 @@ snapshots: dependencies: '@scure/bip32': 1.6.1 abitype: 1.0.8(typescript@5.6.3)(zod@3.24.1) - axios: 1.7.9 + axios: 1.7.9(debug@4.4.0) axios-mock-adapter: 1.22.0(axios@1.7.9) axios-retry: 4.5.0(axios@1.7.9) bip32: 4.0.0 @@ -27429,7 +27429,7 @@ snapshots: '@eslint/config-array@0.19.1': dependencies: '@eslint/object-schema': 2.1.5 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -27459,7 +27459,7 @@ snapshots: '@eslint/eslintrc@3.2.0': dependencies: ajv: 6.12.6 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) espree: 10.3.0 globals: 14.0.0 ignore: 5.3.2 @@ -28498,41 +28498,6 @@ snapshots: - supports-color - ts-node - '@jest/core@29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3))': - dependencies: - '@jest/console': 29.7.0 - '@jest/reporters': 29.7.0 - '@jest/test-result': 29.7.0 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - '@types/node': 20.17.9 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - ci-info: 3.9.0 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) - jest-haste-map: 29.7.0 - jest-message-util: 29.7.0 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-resolve-dependencies: 29.7.0 - jest-runner: 29.7.0 - jest-runtime: 29.7.0 - jest-snapshot: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - jest-watcher: 29.7.0 - micromatch: 4.0.8 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-ansi: 6.0.1 - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - - ts-node - '@jest/core@29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3))': dependencies: '@jest/console': 29.7.0 @@ -33791,7 +33756,7 @@ snapshots: '@tavily/core@0.0.2': dependencies: - axios: 1.7.9 + axios: 1.7.9(debug@4.4.0) js-tiktoken: 1.0.15 transitivePeerDependencies: - debug @@ -34575,7 +34540,7 @@ snapshots: '@typescript-eslint/types': 8.16.0 '@typescript-eslint/typescript-estree': 8.16.0(typescript@5.6.3) '@typescript-eslint/visitor-keys': 8.16.0 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) eslint: 9.16.0(jiti@2.4.2) optionalDependencies: typescript: 5.6.3 @@ -34638,7 +34603,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 8.16.0(typescript@5.6.3) '@typescript-eslint/utils': 8.16.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.6.3) - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) eslint: 9.16.0(jiti@2.4.2) ts-api-utils: 1.4.3(typescript@5.6.3) optionalDependencies: @@ -34694,7 +34659,7 @@ snapshots: dependencies: '@typescript-eslint/types': 8.16.0 '@typescript-eslint/visitor-keys': 8.16.0 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) fast-glob: 3.3.3 is-glob: 4.0.3 minimatch: 9.0.5 @@ -35927,7 +35892,7 @@ snapshots: agent-base@6.0.2: dependencies: - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -36453,7 +36418,7 @@ snapshots: axios-mock-adapter@1.22.0(axios@1.7.9): dependencies: - axios: 1.7.9 + axios: 1.7.9(debug@4.4.0) fast-deep-equal: 3.1.3 is-buffer: 2.0.5 @@ -36464,7 +36429,7 @@ snapshots: axios-retry@4.5.0(axios@1.7.9): dependencies: - axios: 1.7.9 + axios: 1.7.9(debug@4.4.0) is-retry-allowed: 2.2.0 axios@0.21.4: @@ -36481,7 +36446,7 @@ snapshots: axios@0.27.2: dependencies: - follow-redirects: 1.15.9 + follow-redirects: 1.15.9(debug@4.4.0) form-data: 4.0.1 transitivePeerDependencies: - debug @@ -36518,14 +36483,6 @@ snapshots: transitivePeerDependencies: - debug - axios@1.7.9: - dependencies: - follow-redirects: 1.15.9 - form-data: 4.0.1 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - axios@1.7.9(debug@4.4.0): dependencies: follow-redirects: 1.15.9(debug@4.4.0) @@ -38054,21 +38011,6 @@ snapshots: - supports-color - ts-node - create-jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)): - dependencies: - '@jest/types': 29.6.3 - chalk: 4.1.2 - exit: 0.1.2 - graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) - jest-util: 29.7.0 - prompts: 2.4.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - create-jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): dependencies: '@jest/types': 29.6.3 @@ -38663,10 +38605,6 @@ snapshots: dependencies: ms: 2.1.3 - debug@4.4.0: - dependencies: - ms: 2.1.3 - debug@4.4.0(supports-color@5.5.0): dependencies: ms: 2.1.3 @@ -39748,7 +39686,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) escape-string-regexp: 4.0.0 eslint-scope: 8.2.0 eslint-visitor-keys: 4.2.0 @@ -40471,8 +40409,6 @@ snapshots: async: 0.2.10 which: 1.3.1 - follow-redirects@1.15.9: {} - follow-redirects@1.15.9(debug@4.3.7): optionalDependencies: debug: 4.3.7 @@ -41550,7 +41486,7 @@ snapshots: http-proxy-agent@7.0.2: dependencies: agent-base: 7.1.3 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -41606,14 +41542,14 @@ snapshots: https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) transitivePeerDependencies: - supports-color https-proxy-agent@7.0.6: dependencies: agent-base: 7.1.3 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -42224,7 +42160,7 @@ snapshots: istanbul-lib-source-maps@4.0.1: dependencies: - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: @@ -42360,25 +42296,6 @@ snapshots: - supports-color - ts-node - jest-cli@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)): - dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) - '@jest/test-result': 29.7.0 - '@jest/types': 29.6.3 - chalk: 4.1.2 - create-jest: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) - exit: 0.1.2 - import-local: 3.2.0 - jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) - jest-util: 29.7.0 - jest-validate: 29.7.0 - yargs: 17.7.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - jest-cli@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): dependencies: '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) @@ -42498,37 +42415,6 @@ snapshots: - babel-plugin-macros - supports-color - jest-config@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)): - dependencies: - '@babel/core': 7.26.0 - '@jest/test-sequencer': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.26.0) - chalk: 4.1.2 - ci-info: 3.9.0 - deepmerge: 4.3.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-circus: 29.7.0(babel-plugin-macros@3.1.0) - jest-environment-node: 29.7.0 - jest-get-type: 29.6.3 - jest-regex-util: 29.6.3 - jest-resolve: 29.7.0 - jest-runner: 29.7.0 - jest-util: 29.7.0 - jest-validate: 29.7.0 - micromatch: 4.0.8 - parse-json: 5.2.0 - pretty-format: 29.7.0 - slash: 3.0.0 - strip-json-comments: 3.1.1 - optionalDependencies: - '@types/node': 20.17.9 - ts-node: 10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3) - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - jest-config@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): dependencies: '@babel/core': 7.26.0 @@ -42885,18 +42771,6 @@ snapshots: - supports-color - ts-node - jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)): - dependencies: - '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) - '@jest/types': 29.6.3 - import-local: 3.2.0 - jest-cli: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): dependencies: '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) @@ -45207,7 +45081,7 @@ snapshots: '@yarnpkg/lockfile': 1.1.0 '@yarnpkg/parsers': 3.0.0-rc.46 '@zkochan/js-yaml': 0.0.7 - axios: 1.7.9 + axios: 1.7.9(debug@4.4.0) chalk: 4.1.0 cli-cursor: 3.1.0 cli-spinners: 2.6.1 @@ -48496,7 +48370,7 @@ snapshots: socks-proxy-agent@8.0.5: dependencies: agent-base: 7.1.3 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) socks: 2.8.3 transitivePeerDependencies: - supports-color @@ -49632,27 +49506,6 @@ snapshots: optionalDependencies: '@swc/core': 1.10.7(@swc/helpers@0.5.15) - ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3): - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.11 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 20.17.9 - acorn: 8.14.0 - acorn-walk: 8.3.4 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.6.3 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - optionalDependencies: - '@swc/core': 1.10.7(@swc/helpers@0.5.15) - optional: true - ts-node@10.9.2(@swc/core@1.10.7(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3): dependencies: '@cspotcode/source-map-support': 0.8.1 @@ -49833,7 +49686,7 @@ snapshots: tuf-js@2.2.1: dependencies: '@tufjs/models': 2.0.1 - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) make-fetch-happen: 13.0.1 transitivePeerDependencies: - supports-color