forked from assafelovic/gpt-researcher
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'edit-docs' of https://github.com/scchengaiah/gpt-resear…
…cher-fork into edit-docs # Conflicts: # docs/docs/gpt-researcher/llms/llms.md
- Loading branch information
Showing
46 changed files
with
900 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
# Contributing to GPT Researcher | ||
First off, we'd like to welcome you, and thank you for your interest and effort in contributing to our open-source project ❤️. Contributions of all forms are welcome, from new features and bug fixes, to documentation and more. | ||
|
||
We are on a mission to build the #1 AI agent for comprehensive, unbiased, and factual research online. And we need your support to achieve this grand vision. | ||
First off, we'd like to welcome you and thank you for your interest and effort in contributing to our open-source project ❤️. Contributions of all forms are welcome—from new features and bug fixes to documentation and more. | ||
|
||
Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. | ||
We are on a mission to build the #1 AI agent for comprehensive, unbiased, and factual research online, and we need your support to achieve this grand vision. | ||
|
||
Please take a moment to review this document to make the contribution process easy and effective for everyone involved. | ||
|
||
## Reporting Issues | ||
|
||
If you come across any issue or have an idea for an improvement, don't hesitate to create an issue on GitHub. Describe your problem in sufficient detail, providing as much relevant information as possible. This way, we can reproduce the issue before attempting to fix it or respond appropriately. | ||
|
||
## Contributing Code | ||
|
||
1. **Fork the repository and create your branch from `master`.** | ||
If it's not an urgent bug fix, you should branch from `master` and work on the feature or fix in there. | ||
|
||
2. **Conduct your changes.** | ||
Make your changes following best practices for coding in the project's language. | ||
1. **Fork the repository and create your branch from `master`.** | ||
If it’s not an urgent bug fix, branch from `master` and work on the feature or fix there. | ||
|
||
3. **Test your changes.** | ||
Make sure your changes pass all the tests if there are any. If the project doesn't have automated testing infrastructure, test your changes manually to confirm they behave as expected. | ||
2. **Make your changes.** | ||
Implement your changes following best practices for coding in the project's language. | ||
|
||
4. **Follow the coding style.** | ||
Ensure your code adheres to the coding conventions used throughout the project, that includes indentation, accurate comments, etc. | ||
3. **Test your changes.** | ||
Ensure that your changes pass all tests if any exist. If the project doesn’t have automated tests, test your changes manually to confirm they behave as expected. | ||
|
||
5. **Commit your changes.** | ||
Make your git commits informative and concise. This is very helpful for others when they look at the git log. | ||
4. **Follow the coding style.** | ||
Ensure your code adheres to the coding conventions used throughout the project, including indentation, accurate comments, etc. | ||
|
||
6. **Push to your fork and submit a pull request.** | ||
When your work is ready and passes tests, push your branch to your fork of the repository and submit a pull request from there. | ||
5. **Commit your changes.** | ||
Make your Git commits informative and concise. This is very helpful for others when they look at the Git log. | ||
|
||
7. **Pat your back and wait for the review.** | ||
Your work is done, congratulations! Now sit tight. The project maintainers will review your submission as soon as possible. They might suggest changes or ask for improvements. Both constructive conversation and patience are key to the collaboration process. | ||
6. **Push to your fork and submit a pull request.** | ||
When your work is ready and passes tests, push your branch to your fork of the repository and submit a pull request from there. | ||
|
||
7. **Pat yourself on the back and wait for review.** | ||
Your work is done, congratulations! Now sit tight. The project maintainers will review your submission as soon as possible. They might suggest changes or ask for improvements. Both constructive conversation and patience are key to the collaboration process. | ||
|
||
## Documentation | ||
|
||
If you would like to contribute to the project's documentation, please follow the same steps: fork the repository, make your changes, test them, and submit a pull request. | ||
If you would like to contribute to the project's documentation, please follow the same steps: fork the repository, make your changes, test them, and submit a pull request. | ||
|
||
Documentation is a vital part of any software. It's not just about having good code. Ensuring that the users and contributors understand what's going on, how to use the software or how to contribute, is crucial. | ||
Documentation is a vital part of any software. It's not just about having good code; ensuring that users and contributors understand what's going on, how to use the software, or how to contribute is crucial. | ||
|
||
We're grateful for all our contributors, and we look forward to building the world's leading AI research agent hand-in-hand with you. Let's harness the power of Open Source and AI to change the world together! | ||
We're grateful for all our contributors, and we look forward to building the world's leading AI research agent hand-in-hand with you. Let's harness the power of open source and AI to change the world together! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
docs/docs/gpt-researcher/gptr/handling-logs-as-they-stream.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Handling Logs | ||
|
||
Here is a snippet of code to help you handle the streaming logs of your Research tasks. | ||
|
||
```python | ||
from typing import Dict, Any | ||
import asyncio | ||
from gpt_researcher import GPTResearcher | ||
|
||
class CustomLogsHandler: | ||
"""A custom Logs handler class to handle JSON data.""" | ||
def __init__(self): | ||
self.logs = [] # Initialize logs to store data | ||
|
||
async def send_json(self, data: Dict[str, Any]) -> None: | ||
"""Send JSON data and log it.""" | ||
self.logs.append(data) # Append data to logs | ||
print(f"My custom Log: {data}") # For demonstration, print the log | ||
|
||
async def run(): | ||
# Define the necessary parameters with sample values | ||
|
||
query = "What happened in the latest burning man floods?" | ||
report_type = "research_report" # Type of report to generate | ||
report_source = "online" # Could specify source like 'online', 'books', etc. | ||
tone = "informative" # Tone of the report ('informative', 'casual', etc.) | ||
config_path = None # Path to a config file, if needed | ||
|
||
# Initialize researcher with a custom WebSocket | ||
custom_logs_handler = CustomLogsHandler() | ||
|
||
researcher = GPTResearcher( | ||
query=query, | ||
report_type=report_type, | ||
report_source=report_source, | ||
tone=tone, | ||
config_path=config_path, | ||
websocket=custom_logs_handler | ||
) | ||
|
||
await researcher.conduct_research() # Conduct the research | ||
report = await researcher.write_report() # Write the research report | ||
|
||
return report | ||
|
||
# Run the asynchronous function using asyncio | ||
if __name__ == "__main__": | ||
asyncio.run(run()) | ||
``` | ||
|
||
The data from the research process will be logged and stored in the `CustomLogsHandler` instance. You can customize the logging behavior as needed for your application. | ||
|
||
Here's a sample of the output: | ||
|
||
``` | ||
{ | ||
"type": "logs", | ||
"content": "added_source_url", | ||
"output": "✅ Added source url to research: https://www.npr.org/2023/09/28/1202110410/how-rumors-and-conspiracy-theories-got-in-the-way-of-mauis-fire-recovery\n", | ||
"metadata": "https://www.npr.org/2023/09/28/1202110410/how-rumors-and-conspiracy-theories-got-in-the-way-of-mauis-fire-recovery" | ||
} | ||
``` | ||
|
||
The `metadata` field will include whatever metadata is relevant to the log entry. Let the script above run to completion for the full logs output of a given research task. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.