Genereadme v 릴리스

DDD
풀어 주다: 2024-09-18 19:26:07
원래의
682명이 탐색했습니다.

v0.1 출시

오픈 소스 수업의 첫 번째 과제로 우리는 LLM을 활용하는 CLI 도구용 릴리스 0.1을 만드는 임무를 받았습니다. 일련의 요구 사항을 충족하는 한 모든 종류의 도구가 될 수 있습니다. OpenAI의 채팅 완성 기능을 사용해야 하며 명령줄 인수를 통해 파일을 처리하고 변환하는 것에 관한 것이어야 합니다.

Genereadme

저는 과제를 위해 제공된 소스 코드 파일에 대한 README 파일을 생성하는 CLI 도구인 Genereadme를 만들기로 선택했습니다. 나는 README 문서를 작성하는 것이 나에게 적합하지 않고 번거로움을 느끼기 때문에 이 프로젝트를 선택했습니다. 그러나 특히 대규모 프로젝트에서 문서가 얼마나 중요한지를 고려하면 개발 프로세스에서 이 단계를 무시할 수 없습니다. 그래서 대신 제가 이 일을 하는 데 도움이 될 수 있는 것을 만들어 보는 것은 어떨까요?

Genereadme v release 클레오벤트라 / 유전자 읽어보기

GENEREADME는 소스 코드 파일을 가져와서 LLM을 활용하여 파일의 코드를 설명하는 README.md 파일을 생성하는 명령줄 도구입니다.

GENEREADME

GENEREADME는 파일을 가져와 처리하고 파일 내용에 대한 설명이나 문서가 포함된 README 파일을 생성하는 명령줄 도구입니다. 이 도구는 OpenAI 채팅 완성 기능을 활용하여 파일을 분석하고 콘텐츠를 생성합니다.

Genereadme v release

사용방법

.env 파일을 생성하거나 -a 또는 --api-key 플래그를 통해 유효한 API 키를 제공하세요.

GROQ_API_KEY=API_KEY

or

genereadme -a API_KEY
genereadme --api-key API_KEY
로그인 후 복사

종속성 설치:

npm install
로그인 후 복사

기존 샘플 파일로 도구를 실행하거나 직접 사용하여 시작하세요.

genereadme <files>
genereadme examples/sum.js
genereadme examples/createUser.js examples/sum.js
로그인 후 복사

참고: 이 도구는 모든 파일을 허용하지만 콘텐츠로 코드가 있는 파일에 대해서만 적절하게 생성된 결과를 제공합니다.
사용할 파일은 적절한 경로만 제공하면 어디에나 배치할 수 있습니다.


플래그 옵션

<테이블> <머리> 깃발 설명 사용 <본체> -v
flag description usage
-v
--version
Displays the tool's name and the current version. genereadme -v
genereadme --version
--버전 도구 이름과 현재 버전을 표시합니다. <🎜>genereadme<🎜> -v<🎜><🎜>genereadme<🎜> --version
View on GitHub

Get started

Simply install the packages after cloning the repository

npm install
로그인 후 복사

Run and generate!

genereadme examples/sum.js
genereadme examples/createUser.js
genereadme examples/sum.js examples/createUser.js
genereadme examples/sum.js examples/createUser.js --output sample.md
로그인 후 복사

How it works

The user can pass any number of files in the command line using the command genereadme .... The contents of these files will be processed individually to generate their README documentation.
The generated READMEs will be saved as filename_README.md to prevent any naming collision when processing multiple files.

Arguments

  • : The file to be processed and generate a README for.

Options

  • -v or --version: Displays the tool's name and the current version.
  • -h or --help: Displays the help message for the tool.
  • -o or --output: Outputs the generated results into the specified output filename.
  • -a or --api-key: Allows the user to use their own valid API key.
  • -t or --temperature: Allows the user to set their preferred temperature for the chat completion.
  • -tu or --token-usage: Shows the amount of tokens used for the prompt and the completion.

Genereadme v release

Examples

genereadme examples/createUser.js

export async function createUser(data) {
    const user = {
      Username: data.email,
      UserPoolId: process.env.AWS_COGNITO_POOL_ID,
      TemporaryPassword: data.temporaryPassword,
      UserAttributes: [
        {
          Name: "email",
          Value: data.email,
        },
        {
          Name: "name",
          Value: data.name,
        },
      ],
      MessageAction: MessageActionType.SUPPRESS,
      DesiredDeliveryMediums: [DeliveryMediumType.EMAIL],
    };

    const command = new AdminCreateUserCommand(user);
    try {
      const createRes = await cognitoClient.send(command);
      logger.info(`Created user: [${JSON.stringify(createRes)}]`);

      const addUserToGroupParams = {
        UserPoolId: process.env.AWS_COGNITO_POOL_ID,
        Username: data.email,
        GroupName: data.group,
      };

      const addUserToGroupCommand = new AdminAddUserToGroupCommand(addUserToGroupParams);
      const addRes = await cognitoClient.send(addUserToGroupCommand);
      logger.info(`Added user to group: [${JSON.stringify(addRes)}]`);
    } catch (error) {
      logger.error(`Error creating user: ${error}`);
      throw new Error("Error creating user.");
    }
  }
로그인 후 복사

generated README for createUser.js

Genereadme v release

Conclusion

It is my first time working directly with LLMs by myself, so it definitely took some time prompt engineering to get a somewhat satisfying result. However, I do know that there are still a lot that can be improved on and I'm already getting ideas on what to do and what else I can add to this project!

위 내용은 Genereadme v 릴리스의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

원천:dev.to
이전 기사:Node.js 애플리케이션 확장: 기술 및 모범 사례 다음 기사:TypeScript React 앱에 Juspay를 통합하기 위한 간단한 가이드
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
저자별 최신 기사
최신 이슈
관련 주제
더>
인기 추천
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!