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

A few proposed modifications #20

Merged
merged 6 commits into from
May 12, 2024
Merged

A few proposed modifications #20

merged 6 commits into from
May 12, 2024

Conversation

kongzii
Copy link
Contributor

@kongzii kongzii commented May 6, 2024

Hi, I'm working on a bot that should resolve prediction markets after some event has happened. And your project seems like a great fit for such a use case.

I did a few experiments, and they look very promising.

This PR contains a few modifications; I'll comment on them in the code for clarity.

If you would be so kind to provide feedback about the proposed changes, it would be great 🤞 Of course, I'm happy to add any modifications/updates that you may comment on before merging.

@@ -29,6 +29,7 @@ def __init__(
evidence_retrieval_model: str = None,
claim_verify_model: str = None,
api_config: dict = None,
num_seed_retries: int = 3,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Allow to modify num_retries while initing FactCheck class.

merge_evidence_text = [f"Text: {_result['snippet']} \n Source: {_result['link']}" for _result in results]
merge_evidence_text = [re.sub(r"\n+", "\n", evidence) for evidence in merge_evidence_text]
merge_evidence_text = [
f"Text: {_result['snippet']} \n Source: {_result['link']} \n Date: {_result.get('date', 'Unknown')}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Include the date of the result in the prompt. Thanks to this, OFV can verify claims such as "Did X happen before Y?"

Copy link
Member

Choose a reason for hiding this comment

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

Hi! The inclusion of the date as a separate factor might be helpful, but I suspect it is not essential. In your example, "X happens before Y," we would expect the generated queries to be like ["When did X happen?", "When did Y happen?"]. Given such queries, retrieved evidence is expected to be sufficient to solve this problem.

Prompt for query generation:
https://github.com/Libr-AI/OpenFactVerification/blob/f620f6e5879ee1219661afc749c9fd8f658b194b/factcheck/utils/prompt/chatgpt_prompt.py#L43C1-L62

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, sorry for late reply, I was on vacation.

Unfortunately, not all articles come with clear dates in them. But Serp can return their creation date anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this could be available behind a flag in FactCheck's initialisation?

@@ -1,7 +1,9 @@
[tool.poetry]
package-mode = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Allow the installation of OFV as a package in another repository.

@@ -24,7 +26,7 @@ python = "^3.9"
anthropic = "^0.23.1"
backoff = "^2.2.1"
bs4 = "^0.0.2"
Flask = "^3.0.3"
Flask = { version = "^3.0.3", optional = true }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make Flask optional to reduce conflicts with other repositories, as Flask is not required for the core OFV functionality.

@kongzii kongzii mentioned this pull request May 7, 2024
10 tasks
@haonan-li
Copy link
Member

Thank you for your contribution!

@haonan-li haonan-li merged commit af71b0f into Libr-AI:main May 12, 2024
1 check passed
@kongzii kongzii deleted the peter/mech branch May 13, 2024 09:05
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