Spaces:
Runtime error
Runtime error
Update article_generator.py
Browse files- article_generator.py +4 -1
article_generator.py
CHANGED
|
@@ -15,6 +15,9 @@ tavily_api_key = os.getenv('TAVILY_API_KEY')
|
|
| 15 |
# Tavily APIのカスタムツールを定義
|
| 16 |
class EnhancedTavilySearchTool:
|
| 17 |
def search(self, query):
|
|
|
|
|
|
|
|
|
|
| 18 |
params = {
|
| 19 |
'api_key': tavily_api_key,
|
| 20 |
'query': query,
|
|
@@ -41,7 +44,7 @@ def save_state(state):
|
|
| 41 |
|
| 42 |
def load_state():
|
| 43 |
if os.path.exists(state_file):
|
| 44 |
-
with open(state_file, "r", encoding="utf-8") as f:
|
| 45 |
return json.load(f)
|
| 46 |
return None
|
| 47 |
|
|
|
|
| 15 |
# Tavily APIのカスタムツールを定義
|
| 16 |
class EnhancedTavilySearchTool:
|
| 17 |
def search(self, query):
|
| 18 |
+
if len(query) < 5:
|
| 19 |
+
query += " details" # クエリを拡張して必要な文字数にする
|
| 20 |
+
|
| 21 |
params = {
|
| 22 |
'api_key': tavily_api_key,
|
| 23 |
'query': query,
|
|
|
|
| 44 |
|
| 45 |
def load_state():
|
| 46 |
if os.path.exists(state_file):
|
| 47 |
+
with open(state_file, "r", encoding="utf-8") as f):
|
| 48 |
return json.load(f)
|
| 49 |
return None
|
| 50 |
|