Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes made in the article_generation.py and storm_dataclass.py to a… #192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ build/
*.egg-info/
.idea
.venv
/frontend/demo_light/DEMO_WORKING_DIR/

# Project-specific
secrets.toml
*.log
*/assertion.log
*results/
.venv/
.venv/

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Introduction
# History
## Origins
## Expansion and Growth
## Present Day
# Technology and Infrastructure
## Satellite Technology
## Ground Stations
## Network Architecture
# Services Offered
## Television Broadcasting
## Internet Services
## Telephony
## Business Solutions
# Geographic Coverage
## Domestic
## International
# Regulatory and Legal Environment
## Licensing
## Compliance Issues
## Privacy and Security
# Partnerships and Collaborations
## Media Companies
## Technology Partners
## Government Agencies
# Future Developments
## Technological Advances
## Market Expansion
## Strategic Goals
# Criticisms and Controversies
## Service Quality
## Pricing and Accessibility
## Environmental Impact

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"conv_simulator_lm": {"temperature": 1.0, "max_tokens": 500, "top_p": 0.9, "frequency_penalty": 0, "presence_penalty": 0, "n": 1, "model": "gpt-4o-mini-2024-07-18"}, "question_asker_lm": {"temperature": 1.0, "max_tokens": 500, "top_p": 0.9, "frequency_penalty": 0, "presence_penalty": 0, "n": 1, "model": "gpt-4o"}, "outline_gen_lm": {"temperature": 1.0, "max_tokens": 400, "top_p": 0.9, "frequency_penalty": 0, "presence_penalty": 0, "n": 1, "model": "gpt-4-0125-preview"}, "article_gen_lm": {"temperature": 1.0, "max_tokens": 700, "top_p": 0.9, "frequency_penalty": 0, "presence_penalty": 0, "n": 1, "model": "gpt-4o-2024-05-13"}, "article_polish_lm": {"temperature": 1.0, "max_tokens": 4000, "top_p": 0.9, "frequency_penalty": 0, "presence_penalty": 0, "n": 1, "model": "gpt-4o-2024-05-13"}}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Introduction
# Overview of CRW Telesystem
## Primary Functions and Objectives
## Role in the Polish Defense Sector
# History and Development
## Establishment and Evolution
## Key Milestones and Achievements
### Development of the GROM and PIORUN Missile Systems
### Participation in the Pustelnik Program
# Technological Innovations and Products
## Portable Anti-Aircraft Missile Systems
### GROM Missile System
### PIORUN Missile System
## Anti-Tank Guided Missile Systems
### Pirat ATGM
### Technological Features and Capabilities
## Laser-Guided Systems
### Laser Target Designation Systems
### Development of Laser Protection Systems
## Advanced Laser Technology
### Semiconductor Laser Technologies
### Integration in Military Operations
# Projects and Collaborations
## Key Projects
### Pirat Anti-Tank Guided Missile Project
### APR 120 and APR 155 Guided Artillery Missiles
## Collaborations
### Domestic and International Partnerships
### Role in DEFENSE24 DAY & SOFEAST Conference
# Impact and Contributions
## Enhancing Poland's Defense Capabilities
## Contributions to National and International Security
## Technological Independence and Innovation
# Future Directions
## Ongoing Research and Development Projects
### Focus on Advanced Laser-Guided Technologies
## Strategic Goals and Market Expansion
# Criticisms and Challenges
## Challenges in Defense Technology Development
## Addressing Technological and Operational Limitations

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions frontend/demo_light/demo_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

# If you install the source code instead of the `knowledge-storm` package,
# Uncomment the following lines:
# import sys
# sys.path.append('../../')
import sys
sys.path.append('../../')
from knowledge_storm import STORMWikiRunnerArguments, STORMWikiRunner, STORMWikiLMConfigs
from knowledge_storm.lm import OpenAIModel
from knowledge_storm.rm import YouRM
Expand Down Expand Up @@ -463,6 +463,10 @@ def _display_persona_conversations(conversation_log):

def _display_main_article(selected_article_file_path_dict, show_reference=True, show_conversation=True):
article_data = DemoFileIOHelper.assemble_article_data(selected_article_file_path_dict)

if article_data is None:
st.error("Failed to load article data.")
return

with st.container(height=1000, border=True):
table_content_sidebar = st.sidebar.expander("**Table of contents**", expanded=True)
Expand Down Expand Up @@ -504,8 +508,8 @@ def set_storm_runner():

# configure STORM runner
llm_configs = STORMWikiLMConfigs()
llm_configs.init_openai_model(openai_api_key=st.secrets['OPENAI_API_KEY'], openai_type='openai')
llm_configs.set_question_asker_lm(OpenAIModel(model='gpt-4-1106-preview', api_key=st.secrets['OPENAI_API_KEY'],
llm_configs.init_openai_model(openai_api_key=st.secrets['OPENAI_API_KEY'], openai_type='openai',azure_api_key=None)
llm_configs.set_question_asker_lm(OpenAIModel(model='gpt-4o', api_key=st.secrets['OPENAI_API_KEY'],
api_provider='openai',
max_tokens=500, temperature=1.0, top_p=0.9))
engine_args = STORMWikiRunnerArguments(
Expand Down
Empty file added frontend/demo_light/markdown
Empty file.
17 changes: 10 additions & 7 deletions knowledge_storm/storm_wiki/modules/article_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def generate_article(
sections_to_write = article_with_outline.get_first_level_section_names()

section_output_dict_collection = []
if len(sections_to_write) == 0:
if not sections_to_write:
logging.error(
f"No outline for {topic}. Will directly search with the topic."
)
Expand Down Expand Up @@ -124,13 +124,16 @@ def generate_article(
section_output_dict_collection.append(future.result())

article = copy.deepcopy(article_with_outline)

for section_output_dict in section_output_dict_collection:
article.update_section(
parent_section_name=topic,
current_section_content=section_output_dict["section_content"],
current_section_info_list=section_output_dict["collected_info"],
)
article.post_processing()
if article.has_section(section_output_dict["section_name"]):
article.update_section(
parent_section_name=topic,
current_section_content=section_output_dict["section_content"],
current_section_info_list=section_output_dict["collected_info"],
)
else:
logging.warning(f"Section {section_output_dict['section_name']} not found in the article outline. Skipping update.")
return article


Expand Down
3 changes: 3 additions & 0 deletions knowledge_storm/storm_wiki/modules/storm_dataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def __init__(self, topic_name):
super().__init__(topic_name=topic_name)
self.reference = {"url_to_unified_index": {}, "url_to_info": {}}

def has_section(self, section_name: str) -> bool:
return self.find_section(self.root, section_name) is not None

def find_section(
self, node: ArticleSectionNode, name: str
) -> Optional[ArticleSectionNode]:
Expand Down