Skip to content

Commit a6ecb08

Browse files
authored
Merge pull request #65 from ks6088ts-labs/feature/issue-64_add-tools
support bing search via LangChain tool
2 parents 0aed277 + dedb6dc commit a6ecb08

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
- [LangChain > Azure OpenAI](https://python.langchain.com/v0.1/docs/integrations/llms/azure_openai/)
1111
- [Get started with LangSmith](https://docs.smith.langchain.com/)
1212
- [Add message history (memory) > In-memory](https://python.langchain.com/v0.1/docs/expression_language/how_to/message_history/#in-memory)
13+
- [Tool calling agent](https://python.langchain.com/v0.1/docs/modules/agents/agent_types/tool_calling/)
14+
- [LangChain > Tools > Bing Search](https://python.langchain.com/v0.1/docs/integrations/tools/bing_search/)
1315

1416
## Backend
1517

frontend.env.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ AZURE_OPENAI_GPT_MODEL = "gpt-4o"
66

77
LANGCHAIN_TRACING_V2 = "true"
88
LANGCHAIN_API_KEY = "<your-api-key>"
9+
10+
BING_SUBSCRIPTION_KEY = "<your-api-key>"
11+
BING_SEARCH_URL = "https://api.bing.microsoft.com/v7.0/search"

frontend/solutions/chat_langchain.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ def get_session_history(session_id: str) -> BaseChatMessageHistory:
2222
return store[session_id]
2323

2424

25+
def run_bing_search(
26+
query: str,
27+
k=1,
28+
) -> str:
29+
from langchain_community.utilities import BingSearchAPIWrapper
30+
31+
return BingSearchAPIWrapper(k=k).run(query=query)
32+
33+
2534
def start(
2635
backend_url: str,
2736
log_level: int,

0 commit comments

Comments
 (0)