@dvina/agents 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,8 +2,9 @@ import {
2
2
  LangchainModelResolver,
3
3
  __commonJS,
4
4
  __require,
5
- __toESM
6
- } from "./chunk-LEEZCLZM.mjs";
5
+ __toESM,
6
+ convertToLangchainMessages
7
+ } from "./chunk-NHWEEBN2.mjs";
7
8
 
8
9
  // node_modules/braces/lib/utils.js
9
10
  var require_utils = __commonJS({
@@ -21073,8 +21074,7 @@ import { ToolMessage as ToolMessage2 } from "@langchain/core/messages";
21073
21074
  import { Command as Command2 } from "@langchain/langgraph";
21074
21075
  import {
21075
21076
  AIMessageChunk,
21076
- createMiddleware as createMiddleware2,
21077
- HumanMessage as HumanMessage2
21077
+ createMiddleware as createMiddleware2
21078
21078
  } from "langchain";
21079
21079
  var ENABLE_STREAM_DEBUG_LOGS = false;
21080
21080
  function debugLogStream(type, text) {
@@ -21138,21 +21138,10 @@ var LangchainAgent = class {
21138
21138
  messageCountBefore = stateBefore?.values?.messages?.length || 0;
21139
21139
  } catch {
21140
21140
  }
21141
+ const messages = convertToLangchainMessages(input.messages);
21141
21142
  const result = await this.deepAgent.invoke(
21142
21143
  {
21143
- messages: input.messages.map(
21144
- (m) => new HumanMessage2({
21145
- content: m.content.map((c) => {
21146
- if (c.type === "image") {
21147
- return {
21148
- type: "image_url",
21149
- image_url: { url: c.url }
21150
- };
21151
- }
21152
- return c;
21153
- })
21154
- })
21155
- )
21144
+ messages
21156
21145
  },
21157
21146
  {
21158
21147
  configurable: {
@@ -21224,19 +21213,7 @@ var LangchainAgent = class {
21224
21213
  totalTokens: 0,
21225
21214
  cachedPromptTokens: 0
21226
21215
  };
21227
- const messages = input.messages.map(
21228
- (m) => new HumanMessage2({
21229
- content: m.content.map((c) => {
21230
- if (c.type === "image") {
21231
- return {
21232
- type: "image_url",
21233
- image_url: { url: c.url }
21234
- };
21235
- }
21236
- return c;
21237
- })
21238
- })
21239
- );
21216
+ const messages = convertToLangchainMessages(input.messages);
21240
21217
  debugLogStream("message_start", "");
21241
21218
  yield { type: "message_start" };
21242
21219
  const stream = await this.deepAgent.stream(