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

Make decorators work with the new SDK. #115

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

js-ts
Copy link
Collaborator

@js-ts js-ts commented Jan 30, 2025

  • update rendering of run.py
  • switch from component.yaml to configs directory with json files
  • update rendering of .env
  • added .gitignore
  • Changed the name of the directory from agent_pkgs to naptha_modules

@js-ts js-ts requested a review from richardblythman January 30, 2025 15:07
}
logger.info(f"Registering Agent {agent_config}")
agent = await self.hub.create_or_update_agent(agent_config)
logger.info("Registering Agent %s", agent_config)
Copy link
Contributor

Choose a reason for hiding this comment

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

why move away from f string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

reverted.

Copy link
Contributor

Choose a reason for hiding this comment

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

@js-ts This is still unresolved. You have still not reverted the changes to f string in several places. We should be consistent.

if hasattr(deployment, subdeployment) and getattr(deployment, subdeployment):
for submodule in getattr(deployment, subdeployment):
if "module_type" not in submodule.module:
submodule.module["module_type"] = mod_type
modules.append(submodule.module)
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

which case do you use for the decorators. we talked about removing this if statement and having only one case. was that possible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed.

Copy link
Contributor

@richardblythman richardblythman Feb 3, 2025

Choose a reason for hiding this comment

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

@js-ts i still see two cases if not decorator: and else:
why do we need both of these cases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are needed, The two cases support different workflows.

Copy link
Contributor

Choose a reason for hiding this comment

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

can you explain what the two different cases are needed for?

else:
logger.warning(f"No .env file found in {source_dir}")

def copy_configs_directory(source_dir, package_name):
Copy link
Contributor

Choose a reason for hiding this comment

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

where are these copied from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

from this path crew-ai/stock_analysis. where you run poetry run python src/stock_analysis/crew.py

Copy link
Contributor

Choose a reason for hiding this comment

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

So do you create these configs in crew-ai/dtock_analysis and then copy them to a new dir? Why not just create them in the new dir?

Copy link
Contributor

@richardblythman richardblythman Feb 3, 2025

Choose a reason for hiding this comment

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

@js-ts can you clarify on this? why is the configs dir created in crew-ai/stock_analysis initially? Why not create directly at naptha_modules/agent_module?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I created them manually considering that there are several different cases which a generated config couldn't handle.

Copy link
Contributor

Choose a reason for hiding this comment

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

@js-ts can you point me to where the files in configs are created?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh you mean you didn't create them using code? That isn't ideal. Why don't you think code to generate the configs dir will work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you want sample configs like this to be generated which would be just deployment.json and llm_configs.json:
https://github.com/NapthaAI/simple_chat_agent/tree/main/simple_chat_agent/configs
and then the user modifies them to add in things later?
https://github.com/NapthaAI/multiagent_chat/tree/main/multiagent_chat/configs
I thought that this approach lacked relevant generation.
Or
Do you want the configs to be entirely generated based on what ever information we can get from the crew.py file? IDK if sufficient information can be extracted this way rather than having them define it themselves

Do you know a better way of generating them without the issues?

Copy link
Contributor

Choose a reason for hiding this comment

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

@js-ts Yes exactly just create the deployment.json and llm_configs.json.
I think it will look pretty much exactly like this https://github.com/NapthaAI/simple_chat_agent/blob/main/simple_chat_agent/configs/deployment.json
You just need to add the correct module name.
You can just leave the persona field blank.

naptha_sdk/cli.py Outdated Show resolved Hide resolved
logger.info("Module URL: %s", module_url)
logger.info(
"IPFS Hash: %s. You can download it from "
"http://ipfs-gateway.naptha.work/ipfs/%s",
Copy link
Contributor

Choose a reason for hiding this comment

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

is this correct? i thought it was ipfs.naptha.work not ipfs-gateway.naptha.work
@moarshy

with open(env_example_path, 'w') as env_file:
env_file.write('OPENAI_API_KEY=\n')
env_file.write(env_content)
Copy link
Contributor

Choose a reason for hiding this comment

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

@js-ts why do we need this, if .env is copied from crew-ai/stock_analysis?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was previously there and I just aded new keys.

Copy link
Contributor

Choose a reason for hiding this comment

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

@js-ts ok so just to confirm: you prefer to copy the .env from crewai-examples/stock-analysis rather than using this function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The copied env file doesn't get pushed, I thought it would better to keep it if someone else wants to use the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants