feat: claude function call
This commit is contained in:
parent
ad5d81d76a
commit
8583b536cf
|
@ -1,5 +1,5 @@
|
|||
import axiosMod, { AxiosStatic } from "axios";
|
||||
import { WebPDFLoader } from "langchain/document_loaders/web/pdf";
|
||||
import { WebPDFLoader } from "@langchain/community/document_loaders/web/pdf";
|
||||
import { MemoryVectorStore } from "langchain/vectorstores/memory";
|
||||
import { Tool } from "@langchain/core/tools";
|
||||
import {
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
AgentExecutor,
|
||||
AgentStep,
|
||||
createToolCallingAgent,
|
||||
createReactAgent,
|
||||
} from "langchain/agents";
|
||||
import { ACCESS_CODE_PREFIX, ServiceProvider } from "@/app/constant";
|
||||
|
||||
|
@ -414,10 +415,10 @@ export class AgentApi {
|
|||
]);
|
||||
|
||||
const lastMessageContent = reqBody.messages.slice(-1)[0].content;
|
||||
const lastHumanMessage =
|
||||
typeof lastMessageContent === "string"
|
||||
? new HumanMessage(lastMessageContent)
|
||||
: new HumanMessage({ content: lastMessageContent });
|
||||
// const lastHumanMessage =
|
||||
// typeof lastMessageContent === "string"
|
||||
// ? new HumanMessage(lastMessageContent)
|
||||
// : new HumanMessage({ content: lastMessageContent });
|
||||
const agent = createToolCallingAgent({
|
||||
llm,
|
||||
tools,
|
||||
|
@ -432,7 +433,7 @@ export class AgentApi {
|
|||
{
|
||||
input: lastMessageContent,
|
||||
chat_history: pastMessages,
|
||||
// signal: this.controller.signal,
|
||||
signal: this.controller.signal,
|
||||
},
|
||||
{ callbacks: [handler] },
|
||||
)
|
||||
|
|
|
@ -6,6 +6,8 @@ console.log("[Next] build mode", mode);
|
|||
const disableChunk = !!process.env.DISABLE_CHUNK || mode === "export";
|
||||
console.log("[Next] build with chunk: ", !disableChunk);
|
||||
|
||||
process.env.LANGCHAIN_CALLBACKS_BACKGROUND = true;
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
webpack(config) {
|
||||
|
|
Loading…
Reference in New Issue