MindsDB가 @SnoopStein 이란 래퍼 겸 물리학자 챗봇을 만들었다.
일단 이걸 따라하려면 선행되어야 하는 작업이 몇단계 있다.
MindsDB 공식 문서에서 필요하다고 가이드한 트위터 개발 계정 key가 아래와 같이 5개인데, 내 트위터 개발 포털 대쉬보드에서 다 확인가능하다. (뭐지?)
CREATE DATABASE my_twitter_v2
WITH
ENGINE = 'twitter',
PARAMETERS = {
"consumer_key": "your twitter App API key",
"consumer_secret": "your twitter App API key secret",
"bearer_token": "your twitter App bearer TOKEN",
"access_token": "your twitter App Access Token",
"access_token_secret": "your twitter App Access Token Secret"
};
첫번째로, MindsDB SQL Editor 로 이동한다.
sign up 이후 아래와 같은 인터페이스를 확인할 수 있다.
GPT 모델 생성하는 예제 코드
PREDICT response
USING
engine = 'openai',
-- api_key = 'your openai key', -- in MindsDB cloud accounts we provide a default key
model_name = 'gpt-4', -- you can also use 'text-davinci-003' or 'gpt-3.5-turbo'
prompt_template = 'respond to {{text}} by {{author_username}}';
각 명령어가 수행하능 기능
CREATE MODEL mindsdb.gpt_model
: gpt_model 이라는 이름의 머신 러닝 모델 생성PREDICT response
: 모델이 prompt에 기반하여 응답을 예측하도록 함USING engine = 'openai'
: OpenAI 엔진을 사용하도록 함prompt_template
: GPT의 응답양식 지정결과화면
생성한 GPT 모델에 응답을 요청해보자
SELECT response
FROM mindsdb.gpt_model
WHERE author_username = "mindsdb"
AND text = "why is gravity so different on the sun?";
결과화면 - 공식 튜토리얼와 동일한 결과를 확인할 수 있다.
WITH
ENGINE = 'twitter',
PARAMETERS = {
"consumer_key": "your twitter App API key",
"consumer_secret": "your twitter App API key secret",
"bearer_token": "your twitter App bearer TOKEN",
"access_token": "your twitter App Access Token",
"access_token_secret": "your twitter App Access Token Secret"
};
버그
MindsDB 공식 리포의 버그 리포트링크텍스트
Twitter의 Elevated Access 정책이 업데이트 되며 튜토리얼 문서대로 하면 아래와 같은 이슈를 만나게 된다.
Can't connect to db: 403 Forbidden
When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.
해당 이슈는 "bearer_token" 을 제거하면 해결된다는 결론과 함께 closed 상태이다. 하지만 나는 동일한 에러 메시지를 만나고 있다...
추가 문의를 위한 comment 를 남겼으니 내부 기여자들의 답변을 기다리는 수밖에.
MindsDB 커뮤니티 기여 방안들
Here is what you can do:
Go ahead and try out MindsDB by following our tutorials, and in case of problems, you can always report an issue here.
Are you familiar with Python? You can then help us out in resolving open issues. At first, have a look at issues labeled with the good first issue tag, as these should be easy to start.
You can also help us with documentation and tutorials. Here is how you can contribute by writing documentation and tutorials. Don’t forget to follow the style guide.
Share with your friends and spread the word about MindsDB.