First collaboration!

DDD
Release: 2024-09-19 10:37:32
Original
350 people have browsed it

First collaboration!

For this week lab, we are tasked to contribute onto someone else's work through GitHub. What we needed to do is add a new feature in their project that outputs the token info and we needed to trigger that feature with a command line flag.

Her project was creating a readme file for a source code using OpenAI.

First thoughts.

My first thought on collaborating on another work is that I would need to learn their coding style and the language that they used. I'm primarily more familiar with C and JavaScript but almost never touched Python. That was an interesting learning experience, scouring the internet for information on how to code with Python. Thankfully it wasn't too complex of a project and the comments and documentation was great. They were easy to understand.

How I implement the new feature.

After learning how to code with python, I'm now ready to start implement the feature. What I needed to do was figure out how she is doing the cli commands flags. It took several attempts on figuring it out how it works but finally I manage to add a command flag without breaking anything.

After that I needed to add a function that outputs the token usage info. That part wasn't too hard to figure out since I used the same OpenAI provider, Groq. It is mostly a copy of one of her function where it gets the chat completion response from the LLM but more trimmed. I could have trimmed it more to reduce redundancy but I do not want to alter her code too much. So instead just added a new function.

Pull request

After I was done with my implantation I was ready to create a pull request. But she made updates to her project. So first I need to sync with her repo first. Their was a few conflicts but manage to resolve all of them without too much of an issue. Then I just made a pull request, in the description I added, everything I did, did not forget to comment my work and how the new command flag works.

Overall

This was my first time contribute to another work. I find this was a good learning experience. I know that figuring some else coding style will eventually something I need to be efficient at later. Especially almost always be working with someone else or with a team. This also made me think that I cannot slack off on commenting my source code. Because someone may need to review it or alter it. It is easy for me to understand my own code but not for someone else. Documentation is king!

The above is the detailed content of First collaboration!. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template