GPTScript는 개발자 또는 비개발자들이 고급 AI 모델과 상호작용할 수 있게 해주는 오픈소스 프로젝트입니다. 이는 생성적 사전 훈련 변환기(GPT) 모델과 같은 OpenAI에 의해 개발된 모델과 상호작용하기 위한 간소화된, 스크립트 가능한 인터페이스를 제공합니다.
예를 들어, 다음과 같이 도구를 지정하고, 사용할 수 있습니다.
예시.bob이라는 도구 정의
name: bob
description: I'm Bob, a friendly guy.
args: question: The question to ask Bob.
When asked how I am doing, respond with "Thanks for asking "${question}", I'm doing great fellow friendly AI tool!"
예시. bob이라는 도구 활용
tools: bob
Ask Bob how he is doing and let me know exactly what he said.
위 예시의 실행 결과
위 도구 정의 및 사용을 하나의 파일로 만들어서 실행한 결과
$ gptscript bob.gpt
OUTPUT:
Bob said, "Thanks for asking 'How are you doing?', I'm doing great fellow friendly AI tool!"
GPTScript의 핵심은 사용자 친화적인 설계에 있어, 개발자들이 쉽게 작성하고 이해할 수 있는 스크립트를 통해 GPT 모델의 능력을 활용할 수 있게 합니다. 이 접근 방식은 AI를 다양한 애플리케이션에 활용하는 데 있어 진입 장벽을 크게 낮춥니다.
작동 방식
GPTScript는 간단하면서도 강력한 원칙에 기반을 두고, 기본 GPT 모델 사이의 중간자 역할을 합니다:
스크립트 생성: 사용자는 GPTScript의 문법을 사용하여 스크립트를 작성합니다. 이 스크립트는 AI가 수행할 작업을 지정합니다.
모델 상호작용: 스크립트를 실행하면, GPTScript는 지시사항을 처리하고 해당 GPT 모델과 상호작용합니다. 이는 스크립트에 지정된 입력을 모델에 보내고 생성된 출력을 받는 것을 포함합니다.
출력 처리: GPT 모델에서 반환된 출력은 GPTScript를 통해 사용자에게 반환됩니다. 이 출력은 애플리케이션에서 직접 사용되거나 필요에 따라 추가 처리될 수 있습니다.
통합: GPTScript는 기존 개발 워크플로우와 애플리케이션에 쉽게 통합될 수 있도록 설계되어, 개발자들이 코드베이스에 큰 변경을 가하지 않고도 AI 기능을 추가할 수 있게 합니다.
tools: sys.http.get, sys.http.html2text, sys.find, sys.write, mongo_run, mongo_command, init_flask_project
Perform the following actions in this order:
1. Start the MongoDB database.
2. Create a collection in the Mongo instance called `headlines`.
3. Visit https://hackernews.com and get the top ten headlines.
4. Call the init_flask_project tool to set up the directories you will need.
5. Write each headline into the MongoDB collection that you created earlier called `headlines`. Write each one using a separate call to the mongo_command tool. The name of the database in Mongo that these will be written to is `headlines`. Don't forget to escape any quotation marks or apostrophes that appear in the headlines.
6. Generate a simple webserver in Python using Flask that will connect to the database and serve a single page listing all the headlines. Create it in the `headline` directory. Embed a link to the article in each headline displayed on the page.
7. Add some basic CSS styling to make the page look cool and modern. I want it to be dark themed. Style the links to be a light gray color. Make sure the page has a neat header with red accents.
---
name: mongo_run
description: starts a MongoDB database
#!/usr/bin/env bash
docker run --rm -d -p 27017:27017 --name mongodb mongo:latest