Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@
"@dhaiwat10/react-link-preview": "^1.9.1",
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@langchain/community": "^0.0.54",
"@langchain/core": "^0.1.63",
"@langchain/openai": "^0.0.28",
"@langchain/community": "1.1.16",
"@langchain/core": "1.1.26",
"@langchain/langgraph": "^1.1.5",
"@langchain/openai": "1.2.8",
"@mui/icons-material": "^5.10.9",
"@mui/joy": "^5.0.0-beta.48",
"@mui/lab": "^6.0.0-beta.30",
Expand Down Expand Up @@ -136,7 +137,7 @@
"jotai-xstate": "^0.3.0",
"js-cookie": "^3.0.1",
"jsonwebtoken": "^9.0.2",
"langchain": "^0.1.36",
"langchain": "1.2.25",
"lottie-web": "^5.10.1",
"md5": "^2.3.0",
"migrate-mongo-ts": "^1.1.4",
Expand Down Expand Up @@ -233,7 +234,7 @@
"react-i18next": "^11.16.7",
"supertest": "^6.2.4",
"ts-jest": "^29.1.1",
"typescript": "^4.3.5",
"typescript": "^5.3.0",
"wait-on": "9.0.3"
},
"browserslist": [
Expand Down Expand Up @@ -282,7 +283,8 @@
"glob": "^9.0.0",
"tldjs": "2.3.1",
"@compodoc/compodoc": "1.1.21",
"cheerio": "1.0.0-rc.12"
"cheerio": "1.0.0-rc.12",
"@langchain/core/ansi-styles": "5.2.0"
},
"packageManager": "yarn@3.6.3",
"engines": {
Expand Down
14 changes: 10 additions & 4 deletions server/copilot/copilot-chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ import {
import { z } from "zod";

import { DynamicStructuredTool } from "@langchain/core/tools";
import { AgentExecutor, createOpenAIFunctionsAgent } from "langchain/agents";
import {
AgentExecutor,
createToolCallingAgent,
} from "@langchain/classic/agents";
import {
ChatPromptTemplate,
MessagesPlaceholder,
} from "@langchain/core/prompts";
import { HumanMessage, AIMessage } from "langchain/schema";
import { HumanMessage, AIMessage } from "@langchain/core/messages";
import { AutomatedFactCheckingService } from "../automated-fact-checking/automated-fact-checking.service";
import { EditorParseService } from "../editor-parse/editor-parse.service";
import { ConfigService } from "@nestjs/config";
Expand Down Expand Up @@ -127,8 +130,11 @@ export class CopilotChatService {
(message) => this.transformMessage(message)
);
const tools = [
new DynamicStructuredTool(this.getFactCheckingReportTool),
new DynamicStructuredTool(
this.getFactCheckingReportTool as any
),
];

const currentMessageContent =
contextAwareMessagesDto.messages[
contextAwareMessagesDto.messages.length - 1
Expand Down Expand Up @@ -175,7 +181,7 @@ export class CopilotChatService {
apiKey: this.configService.get<string>("openai.api_key"),
});

const agent = await createOpenAIFunctionsAgent({
const agent = await createToolCallingAgent({
llm,
tools,
prompt,
Expand Down
4 changes: 2 additions & 2 deletions server/summarization/summarization-crawler-chain.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PromptTemplate } from "@langchain/core/prompts";
import { Injectable, Logger } from "@nestjs/common";
import { loadSummarizationChain, StuffDocumentsChain } from "langchain/chains";
import { loadSummarizationChain, StuffDocumentsChain } from "@langchain/classic/chains";
import { ChatOpenAI } from "@langchain/openai";
import { openAI } from "../copilot/openAI.constants";
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
import { RecursiveCharacterTextSplitter } from "@langchain/textsplitters";
import { ConfigService } from "@nestjs/config";

@Injectable()
Expand Down
9 changes: 6 additions & 3 deletions server/summarization/summarization-crawler.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { Injectable, Logger } from "@nestjs/common";
import { SummarizationCrawlerChainService } from "./summarization-crawler-chain.service";
import { WebBrowser } from "langchain/tools/webbrowser";
import { WebBrowser } from "@langchain/classic/tools/webbrowser";
import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai";
import { openAI } from "../copilot/openAI.constants";
import { AgentExecutor, createOpenAIToolsAgent } from "langchain/agents";
import {
AgentExecutor,
createToolCallingAgent,
} from "@langchain/classic/agents";
import { ConfigService } from "@nestjs/config";
import colors from "../../src/styles/colors";
import {
Expand Down Expand Up @@ -151,7 +154,7 @@ export class SummarizationCrawlerService {
const embeddings = new OpenAIEmbeddings();
const tools = [new WebBrowser({ model: llm, embeddings })];

const agent = await createOpenAIToolsAgent({
const agent = await createToolCallingAgent({
llm,
tools,
prompt,
Expand Down
Loading
Loading