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

Implement signals (Issue #43) #160

Draft
wants to merge 67 commits into
base: main
Choose a base branch
from

Conversation

AvidEslami
Copy link
Collaborator

@AvidEslami AvidEslami commented May 18, 2023

Summary: This pull request makes progress towards Implementing Signals (Issue #43)

Goal: Provide large language models with targets and other information to support them in strategies. Information can be in the form of a database, web-url, function call, or local file (other types could be added in the future).

Implementation:

  • New Signals class
    • contains member function: add_signal(signal_address)
      • add_signal determines the address type and retrieves the information/signal data from the given address and stores it in a list.
    • 'signals' member variable stores all added signals in a list (can be accessed using return_signals member function)

Tests have been added in the tests folder (test_signals.py) run using pytest.

TODO:

  • Add functionality for database and function call signals.
  • Target specific information from a web-url as opposed to current solution of returning all contents.
  • Store signals in a way that facilitates being supplied to large language models.

Please let me know if you have any suggestions or changes!
Let me know if the problem was misinterpreted or if this solution isn't heading in the desired/optimal direction.

@abrichr abrichr changed the title Implementing signals (Issue #43) Implement signals (Issue #43) May 27, 2023
This was referenced May 28, 2023
openadapt/signals.py Outdated Show resolved Hide resolved
openadapt/signals.py Outdated Show resolved Hide resolved
@abrichr
Copy link
Contributor

abrichr commented Jun 13, 2023

return data


def __access_file_signal(self, file_path):
Copy link
Contributor

@abrichr abrichr Jun 13, 2023

Choose a reason for hiding this comment

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

@AvidEslami what do you think about looking into automatically listing open files and ports?

(This one could be a TODO in this PR and implemented in a followup)

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a function add_pid that listens for files open by a process

Copy link
Collaborator Author

@AvidEslami AvidEslami Jun 22, 2023

Choose a reason for hiding this comment

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

Let's add a function add_pid that listens for files open by a process

Good idea @abrichr!
This is being implemented in c57f0c4, please let me know if additional features or changes are desired!

openadapt/signals.py Outdated Show resolved Hide resolved

def test_add_function_signal():
signals = Signals()
signals.add_signal("sample_package.sample_module.sample_function")
Copy link
Contributor

Choose a reason for hiding this comment

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

@abrichr
Copy link
Contributor

abrichr commented Aug 14, 2023

Refer to #464

@OpenAdaptAI OpenAdaptAI deleted a comment from cr-gpt bot Aug 14, 2023
@AvidEslami
Copy link
Collaborator Author

AvidEslami commented Aug 24, 2023

Currently the next step for recording file signals seems to be using ProcMon from sysinternals: https://learn.microsoft.com/en-us/sysinternals/downloads/procmon.

By setting filters we seem to be able to access opened files, but we still need to investigate how we can access the ProcMon logs from within record.py, in addition to investigating how often ProcMon writes the logs in order for us to access them effectively.

@abrichr
Copy link
Contributor

abrichr commented Mar 2, 2024

@AvidEslami does #464 work here?

@AvidEslami
Copy link
Collaborator Author

@AvidEslami does #464 work here?

Not perfect, but definitely the best we have so far

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.

None yet

2 participants