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

[Demo Enhancement] added storm wiki frontend with themes #135

Closed
wants to merge 6 commits into from

Conversation

jaigouk
Copy link

@jaigouk jaigouk commented Aug 10, 2024

why

  • wish to choose dark / light themes
  • sometimes, search engine may not return results. and there are search engines that are specialised for specific purpose(arxiv. maybe github in the future). I want to be able to choose them before I send request.
  • ollama also can fail. So I want to have an option to "fallback" and continue.

changes

  • themes: dracula soft dark color and other light and dark themes
  • engines: duckduckgo, searxng and arxiv
  • llm: ollama, anthropic
  • users can change search engine before triggering search
  • users can save primary and fallback llm in settings
  • save result files as '*.md'
  • add date to to top of the result file
  • added arize-phoenix to trace.
  • added github ci file to test fallback options for search and llm
  • change number of display columns
  • pagination in sidebar

note

because this frontend is using "fallbacks", I thought it would be better to have separate example instead of overwriting the existing demo_light.

screenshots

storm-wiki-dark-theme-setting storm-wiki-dark-llm-setting
storm-wiki-dark-search-setting storm-wiki-dark-article-new
storm-wiki-dark-article-list storm-wiki-dark-create

dark and light theme

storm-wiki-dark-article storm-wiki-solarized-article

verified llm fallback. ollama failed and gpt4o-mini kicked in and continued to generate the result.

fallback-works

@jaigouk jaigouk marked this pull request as ready for review August 10, 2024 15:22
@shaoyijia shaoyijia changed the title added storm wiki frontend with themes [Demo Enhancement] added storm wiki frontend with themes Aug 10, 2024
@jaigouk
Copy link
Author

jaigouk commented Aug 11, 2024

I wish to have more features like

From my side, updating the existing doc via API would be a killer feature. but I thought it is better to clean things up first and get code review before I dive into those.

@shaoyijia
Copy link
Collaborator

shaoyijia commented Aug 12, 2024

Thank you so much for working on this! The screenshots look really good (I think it could be useful for many). I am a bit busy these days 😔 and plan to go through this PR next weekend.

From my side, updating the existing doc via API would be a killer feature. but I thought it is better to clean things up first and get code review first before I dive into those.

I agree.

Copy link
Collaborator

@shaoyijia shaoyijia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing to this! It's really cool.

I run into issue with the "My Article" page and add some suggestions on making it better.

frontend/storm_wiki/util/storm_runner.py Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We hope to merge frontend/storm_wiki to our main branch since it's really good. Could you revise the Readme.md? You can add the contributor info / other information (e.g., your GitHub account, terms of use, etc.) to the README.md if you would like to.

frontend/storm_wiki/util/consts.py Outdated Show resolved Hide resolved
model_settings=model_settings,
)

for lm_type in [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may want to allow people to configure LMs for these components separately. Currently, we can only use the same LM for all these components based on the interface design. One design philosophy of STORM is that it's a LM-empowered system so different modules can be run with different LMs to jointly optimize the cost and quality. I think viewing the system in this way will be better than viewing it as a chain of GPT-4/a specific LM prompts.

No need to adjust it this in this PR though.

logger.info(f"Raw results from {engine}: {results}")
return results

def _search_duckduckgo(self, query: str) -> List[Dict[str, Any]]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move this part to knowledge_storm/rm.py? Simply setting up a wrapper class for DuckDuckGoSearchAPIWrapper would be good. I think people may want to use it but not sure everyone will be able to find it in this frontend folder.

self.search_engines = self._initialize_search_engines()
self._initialize_domain_restrictions()

def _initialize_search_engines(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yourdm is not registered here. This is a bit confusing as I run into the issue in first run because I add YDC_API_KEY and select the search engine as yourdm.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. same with bing search.

frontend/storm_wiki/README.md Show resolved Hide resolved
return all_articles


def display_article_list(page_size, num_columns):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my test, I can create new article successfully. But "My Articles" does not display properly, it just shows "Showing all 0 articles". I am not sure whether I mess up configuration somewhere.

Also, by reading the code, I have a question: Since st.session_state will be reset every time you restart the streamlit app, how are the articles maintained? Where can I find them?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is handled with https://github.com/jaigouk/storm_wiki/blob/main/pages_util/MyArticles.py#L55
FileIOHelper.get_output_dir(category) used and ` we load articles

I will resolve issues in the weekend. thanks for the feedbacks.

@jaigouk
Copy link
Author

jaigouk commented Sep 5, 2024

@Yucheng-Jiang @shaoyijia it has been a while. i will work on this PR in this weekend. I was thinking about using command pattern to tidy things up. but I think it is better to refactor it with another PR in the future.

@shaoyijia
Copy link
Collaborator

Sounds great! Thank you :)

@jaigouk jaigouk marked this pull request as draft September 9, 2024 16:29
@jaigouk
Copy link
Author

jaigouk commented Sep 9, 2024

it seems that i need to organise files better before I use rm and lm from the storm library. I converted this PR to draft.

@kinoc
Copy link

kinoc commented Sep 24, 2024

Is the PR still active or planned?

@jaigouk
Copy link
Author

jaigouk commented Oct 22, 2024

i guess this is not going to be able to easy to maintain with the codes i added.

@jaigouk jaigouk closed this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants