diff --git a/main.py b/main.py index 51dcd9e8..ed1356a3 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + """ Entry point script for the Deer project. """ diff --git a/server.py b/server.py index 62be824f..a7c424ea 100644 --- a/server.py +++ b/server.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + """ Server script for running the Deer API. """ diff --git a/src/__init__.py b/src/__init__.py index e69de29b..a74d8cf9 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -0,0 +1,3 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + diff --git a/src/agents/__init__.py b/src/agents/__init__.py index 1c6d9111..c235a05e 100644 --- a/src/agents/__init__.py +++ b/src/agents/__init__.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from .agents import research_agent, coder_agent __all__ = ["research_agent", "coder_agent"] diff --git a/src/agents/agents.py b/src/agents/agents.py index 477b7e27..2a4d3303 100644 --- a/src/agents/agents.py +++ b/src/agents/agents.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from langgraph.prebuilt import create_react_agent from src.prompts import apply_prompt_template diff --git a/src/config/__init__.py b/src/config/__init__.py index f1ad7696..c4639c1e 100644 --- a/src/config/__init__.py +++ b/src/config/__init__.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from .tools import SEARCH_MAX_RESULTS, SELECTED_SEARCH_ENGINE, SearchEngine from .loader import load_yaml_config from .questions import BUILT_IN_QUESTIONS, BUILT_IN_QUESTIONS_ZH_CN diff --git a/src/config/agents.py b/src/config/agents.py index 62be2c1e..df65b2af 100644 --- a/src/config/agents.py +++ b/src/config/agents.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from typing import Literal # Define available LLM types diff --git a/src/config/configuration.py b/src/config/configuration.py index 8912b464..8df7a7f5 100644 --- a/src/config/configuration.py +++ b/src/config/configuration.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import os from dataclasses import dataclass, fields from typing import Any, Optional diff --git a/src/config/loader.py b/src/config/loader.py index dff0ed85..a6edfe50 100644 --- a/src/config/loader.py +++ b/src/config/loader.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import os import yaml from typing import Dict, Any diff --git a/src/config/questions.py b/src/config/questions.py index 3254c131..21a906c6 100644 --- a/src/config/questions.py +++ b/src/config/questions.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + """ Built-in questions for Deer. """ diff --git a/src/config/tools.py b/src/config/tools.py index 8b3e5263..37ee9d68 100644 --- a/src/config/tools.py +++ b/src/config/tools.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import os import enum from dotenv import load_dotenv diff --git a/src/crawler/__init__.py b/src/crawler/__init__.py index 5303aa0c..4f6a6e7f 100644 --- a/src/crawler/__init__.py +++ b/src/crawler/__init__.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from .article import Article from .crawler import Crawler diff --git a/src/crawler/article.py b/src/crawler/article.py index ba088b41..fd0c95e6 100644 --- a/src/crawler/article.py +++ b/src/crawler/article.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import re from urllib.parse import urljoin diff --git a/src/crawler/crawler.py b/src/crawler/crawler.py index eb87dcd1..fe7ddfce 100644 --- a/src/crawler/crawler.py +++ b/src/crawler/crawler.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import sys from .article import Article diff --git a/src/crawler/jina_client.py b/src/crawler/jina_client.py index a3ec7327..8cd81ed1 100644 --- a/src/crawler/jina_client.py +++ b/src/crawler/jina_client.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import logging import os diff --git a/src/crawler/readability_extractor.py b/src/crawler/readability_extractor.py index 7bf63e09..a3a22d05 100644 --- a/src/crawler/readability_extractor.py +++ b/src/crawler/readability_extractor.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from readabilipy import simple_json_from_html_string from .article import Article diff --git a/src/graph/__init__.py b/src/graph/__init__.py index 536aa4ce..ec13d9a5 100644 --- a/src/graph/__init__.py +++ b/src/graph/__init__.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from .builder import build_graph __all__ = [ diff --git a/src/graph/builder.py b/src/graph/builder.py index 8425d432..fcb4f394 100644 --- a/src/graph/builder.py +++ b/src/graph/builder.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from langgraph.graph import StateGraph, START, END from langgraph.checkpoint.memory import MemorySaver from .types import State diff --git a/src/graph/nodes.py b/src/graph/nodes.py index 559abf07..4a7a5ca2 100644 --- a/src/graph/nodes.py +++ b/src/graph/nodes.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import logging import json from typing import Literal, Annotated diff --git a/src/graph/types.py b/src/graph/types.py index 4d8a9194..71a208e1 100644 --- a/src/graph/types.py +++ b/src/graph/types.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import operator from langgraph.graph import MessagesState diff --git a/src/llms/__init__.py b/src/llms/__init__.py index e69de29b..a74d8cf9 100644 --- a/src/llms/__init__.py +++ b/src/llms/__init__.py @@ -0,0 +1,3 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + diff --git a/src/llms/llm.py b/src/llms/llm.py index 767cd992..ca5dc75a 100644 --- a/src/llms/llm.py +++ b/src/llms/llm.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from langchain_openai import ChatOpenAI from src.config import load_yaml_config from pathlib import Path diff --git a/src/prompts/__init__.py b/src/prompts/__init__.py index 3831b7ac..e05eaae8 100644 --- a/src/prompts/__init__.py +++ b/src/prompts/__init__.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from .template import apply_prompt_template, get_prompt_template __all__ = [ diff --git a/src/prompts/planner_model.py b/src/prompts/planner_model.py index dc65913c..615d7017 100644 --- a/src/prompts/planner_model.py +++ b/src/prompts/planner_model.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from pydantic import BaseModel, Field from typing import List, Optional from enum import Enum diff --git a/src/prompts/template.py b/src/prompts/template.py index e0c022a6..beafe272 100644 --- a/src/prompts/template.py +++ b/src/prompts/template.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import os import dataclasses from datetime import datetime diff --git a/src/server/__init__.py b/src/server/__init__.py index 34f275ed..b5f0b024 100644 --- a/src/server/__init__.py +++ b/src/server/__init__.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from .app import app __all__ = ["app"] diff --git a/src/server/app.py b/src/server/app.py index fe1b4943..1eca6549 100644 --- a/src/server/app.py +++ b/src/server/app.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import json import logging from typing import List, cast diff --git a/src/server/chat_request.py b/src/server/chat_request.py index 8a44ee35..55d24720 100644 --- a/src/server/chat_request.py +++ b/src/server/chat_request.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from typing import List, Optional, Union from pydantic import BaseModel, Field diff --git a/src/tools/__init__.py b/src/tools/__init__.py index 1d34af81..774938f7 100644 --- a/src/tools/__init__.py +++ b/src/tools/__init__.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + from .crawl import crawl_tool from .python_repl import python_repl_tool from .search import ( diff --git a/src/tools/crawl.py b/src/tools/crawl.py index fa78c5b0..9b1aa972 100644 --- a/src/tools/crawl.py +++ b/src/tools/crawl.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import logging from typing import Annotated diff --git a/src/tools/decorators.py b/src/tools/decorators.py index 0cf4e9e6..a37e82eb 100644 --- a/src/tools/decorators.py +++ b/src/tools/decorators.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import logging import functools from typing import Any, Callable, Type, TypeVar diff --git a/src/tools/python_repl.py b/src/tools/python_repl.py index feb05db0..4b9c0aba 100644 --- a/src/tools/python_repl.py +++ b/src/tools/python_repl.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import logging from typing import Annotated from langchain_core.tools import tool diff --git a/src/tools/search.py b/src/tools/search.py index 9cf8dd29..42441ddc 100644 --- a/src/tools/search.py +++ b/src/tools/search.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import logging import os from langchain_community.tools.tavily_search import TavilySearchResults diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 7507b9d7..baffcc7a 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + """ 工具函数包 """ diff --git a/src/utils/json_utils.py b/src/utils/json_utils.py index 9b0d2fb1..f9c10ff3 100644 --- a/src/utils/json_utils.py +++ b/src/utils/json_utils.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import logging import json import json_repair diff --git a/src/workflow.py b/src/workflow.py index a6abd766..46437e40 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import logging from src.graph import build_graph diff --git a/tests/integration/test_crawler.py b/tests/integration/test_crawler.py index 2672d2d8..e4584bd8 100644 --- a/tests/integration/test_crawler.py +++ b/tests/integration/test_crawler.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import pytest from src.crawler import Crawler diff --git a/tests/integration/test_python_repl_tool.py b/tests/integration/test_python_repl_tool.py index becb3d61..bad03336 100644 --- a/tests/integration/test_python_repl_tool.py +++ b/tests/integration/test_python_repl_tool.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import pytest from src.tools.python_repl import python_repl_tool diff --git a/tests/integration/test_template.py b/tests/integration/test_template.py index d39f9977..04eb4d73 100644 --- a/tests/integration/test_template.py +++ b/tests/integration/test_template.py @@ -1,3 +1,6 @@ +# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates +# SPDX-License-Identifier: MIT + import pytest from src.prompts.template import get_prompt_template, apply_prompt_template