Skip to content

Commit 152e170

Browse files
committed
Merge branch '3.5.x'
2 parents 89c4e26 + 451764a commit 152e170

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

framework/fel/python/plugins/fel_langchain_tools/langchain_tools.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,10 @@
55
# ======================================================================================================================
66
import json
77
from urllib.parse import quote_plus
8-
import psycopg2
9-
from langchain.agents import AgentExecutor
108

11-
from langchain_community.utilities.sql_database import SQLDatabase
12-
from langchain_community.agent_toolkits import create_sql_agent
13-
from langchain_community.tools.sql_database.tool import (
14-
InfoSQLDatabaseTool,
15-
ListSQLDatabaseTool,
16-
QuerySQLCheckerTool,
17-
QuerySQLDataBaseTool,
18-
)
19-
from langchain_core.tools import BaseTool
20-
from langchain_openai import ChatOpenAI, OpenAI
21-
from langchain_community.utilities.requests import TextRequestsWrapper
9+
from langchain.agents import AgentExecutor
2210
from langchain_community.agent_toolkits import JsonToolkit, create_json_agent
11+
from langchain_community.agent_toolkits import create_sql_agent
2312
from langchain_community.tools.json.tool import JsonSpec
2413
from langchain_community.tools.requests.tool import (
2514
RequestsDeleteTool,
@@ -28,6 +17,17 @@
2817
RequestsPostTool,
2918
RequestsPutTool,
3019
)
20+
from langchain_community.tools.sql_database.tool import (
21+
InfoSQLDatabaseTool,
22+
ListSQLDatabaseTool,
23+
QuerySQLCheckerTool,
24+
QuerySQLDataBaseTool,
25+
)
26+
from langchain_community.utilities.requests import TextRequestsWrapper
27+
from langchain_community.utilities.sql_database import SQLDatabase
28+
from langchain_core.tools import BaseTool
29+
from langchain_openai import ChatOpenAI
30+
3131
from .langchain_registers import register_function_tools, register_api_tools
3232

3333

framework/fel/python/plugins/fel_llama_index_tools/llama_rag_basic_toolkit.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,27 @@
33
# This file is a part of the ModelEngine Project.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
55
# ======================================================================================================================
6-
import functools
76
import os
87
import traceback
98
from enum import Enum, unique
10-
from inspect import signature
119
from typing import List, Callable, Any, Tuple
1210

1311
from fitframework import fit_logger
1412
from fitframework.core.repo.fitable_register import register_fitable
15-
from llama_index.core import PromptTemplate
1613
from llama_index.core.base.base_selector import SingleSelection
1714
from llama_index.core.postprocessor import SimilarityPostprocessor, SentenceEmbeddingOptimizer, LLMRerank, \
1815
LongContextReorder, FixedRecencyPostprocessor
1916
from llama_index.core.postprocessor.types import BaseNodePostprocessor
20-
from llama_index.core.prompts import PromptType
17+
from llama_index.core.prompts import PromptType, PromptTemplate
2118
from llama_index.core.prompts.default_prompts import DEFAULT_CHOICE_SELECT_PROMPT_TMPL
2219
from llama_index.core.selectors import LLMSingleSelector, LLMMultiSelector
2320
from llama_index.core.selectors.prompts import DEFAULT_SINGLE_SELECT_PROMPT_TMPL, DEFAULT_MULTI_SELECT_PROMPT_TMPL
2421
from llama_index.embeddings.openai import OpenAIEmbedding
25-
from llama_index.legacy.llms import OpenAILike
22+
from llama_index.llms.openai import OpenAI
2623

2724
from .callable_registers import register_callable_tool
28-
from .types.document import Document
2925
from .node_utils import document_to_query_node, query_node_to_document
26+
from .types.document import Document
3027

3128
os.environ["no_proxy"] = "*"
3229

@@ -80,7 +77,7 @@ def llm_rerank(nodes: List[Document], query_str: str, **kwargs) -> List[Document
8077
choice_batch_size = int(kwargs.get("choice_batch_size") or 10)
8178
top_n = int(kwargs.get("top_n") or 10)
8279

83-
llm = OpenAILike(model=model_name, api_base=api_base, api_key=api_key, max_tokens=4096)
80+
llm = OpenAI(model=model_name, api_base=api_base, api_key=api_key, max_tokens=4096)
8481
choice_select_prompt = PromptTemplate(prompt, prompt_type=PromptType.CHOICE_SELECT)
8582
llm_rerank_obj = LLMRerank(llm=llm, choice_select_prompt=choice_select_prompt, choice_batch_size=choice_batch_size,
8683
top_n=top_n)
@@ -110,7 +107,7 @@ def llm_choice_selector(choice: List[str], query_str: str, **kwargs) -> List[Sin
110107
if mode.lower() not in [m.value for m in SelectorMode]:
111108
raise ValueError(f"Invalid mode {mode}.")
112109

113-
llm = OpenAILike(model=model_name, api_base=api_base, api_key=api_key, max_tokens=4096)
110+
llm = OpenAI(model=model_name, api_base=api_base, api_key=api_key, max_tokens=4096)
114111
if mode.lower() == SelectorMode.SINGLE.value:
115112
selector_prompt = prompt or DEFAULT_SINGLE_SELECT_PROMPT_TMPL
116113
selector = LLMSingleSelector.from_defaults(llm=llm, prompt_template_str=selector_prompt)

framework/fel/python/plugins/fel_llama_index_tools/node_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# ======================================================================================================================
66
from llama_index.core.multi_modal_llms.generic_utils import encode_image
77
from llama_index.core.schema import ImageNode, TextNode, NodeWithScore
8-
from llama_index.core import Document as LDocument
8+
from llama_index.core.schema import Document as LDocument
99

1010
from .types.document import Document
1111
from .types.media import Media

framework/fel/python/plugins/fel_llamaindex_network_tools/llamaindex_network_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# ======================================================================================================================
66

77
import time
8-
from typing import List, Any, Optional, Callable, Union, Tuple
8+
from typing import List, Any, Callable, Tuple
99

1010
from .callable_registers import register_callable_tool
1111

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
pydantic==2.6.3
22
psutil==6.1.1
33
httpx==0.28.1
4-
pandas==2.1.3
4+
pandas==2.1.3
5+
llama-index==0.12.46
6+
langchain-core==0.3.68
7+
langchain_community==0.3.27

0 commit comments

Comments
 (0)