C#/.Net Core

Azure OpenAI 리소스를 활용한 커스텀 ChatGpt 만들기

고라파도옹 2024. 3. 5. 11:23

https://github.com/Azure-Samples/azure-search-openai-demo?tab=readme-ov-file

 

GitHub - Azure-Samples/azure-search-openai-demo: A sample app for the Retrieval-Augmented Generation pattern running in Azure, u

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experien...

github.com

위 소스코드를 기반으로 시작

위 링크의 설명 대로 올바르게 진행했다면 아래 와 같이 Azure 계정에 리소스 들이 생성된다.

애저 리소스 그룹에 생성된 리소스 목록

리소스 목록중 핵심 항목은 아래 5가지다

1.Azure OpenAI : ChatGpt 관련 설정 및 테스트 용도

2.Document intelligence : 커스텀 Gpt 를 사용할때 문서를 임베딩 해주는 리소스

3.Search 서비스 :  임베딩 된 문서 확인 및 문서 기반으로 사용자의 질문에 해당하는 문서를 제공해주는 리소스

4.App Service : github 에서 실행된 소스코드를 기반으로 chatgpt 를 시연해볼수 있는 웹페이지

5.스토리지 계정 : github 소스코드 내에 파일 저장 및 활용하기 위한 스토리지 계정

 

Azure OpenAI 리소스 에서 채팅 및 테스트 기능과 해당 기능을 코드로 구현 할 수 있는 예시도 제공해준다.

채팅 테스트 화면

위 코드 보기에서 사용되는 라이브러리는 아래 링크를 활용해서 바꾸는게 좋다.

코드 보기에서 제공해주는 코드는 이전 버전이 사용되고 있기때문이다. 

azure-sdk-for-net/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md(Azure.AI.OpenAI_1.0.0-beta.14 · Azure/azure-sdk-for-net · 깃허브(GitHub)

아직까진 beta버전이라 자잘한 버그들이 많은 것 같다.....

여기까지 문제 없이 실행했다면 본인의 프로젝트에서 ChatGpt 처럼 질문하고 답변을 받는 것을 구현할 수 있다.

다만 리소스들의 비용이 개인이 부담하기엔 만만치 않으니 주의하기 바란다.

 

그 외 참고한 링크

azure-sdk-for-net/sdk/search/Azure.Search.Documents/README.md at Azure.Search.Documents_11.6.0-beta.2 · Azure/azure-sdk-for-net · GitHub

azure-sdk-for-net/sdk/formrecognizer/Azure.AI.FormRecognizer/README.md at Azure.AI.FormRecognizer_4.1.0 · Azure/azure-sdk-for-net · GitHub

 

소스코드 실행하기 위한 azure cli 참고 링크

https://learn.microsoft.com/ko-kr/azure/developer/azure-developer-cli/install-azd?tabs=script-windows%2Cbrew-mac%2Cscript-linux&pivots=os-windows

 

Azure Developer CLI 설치

로컬 환경에 대한 모든 필수 구성 요소를 사용하여 Azure 개발자 CLI(azd)를 설치합니다.

learn.microsoft.com

https://devblogs.microsoft.com/azure-sdk/introducing-the-azure-developer-cli-a-faster-way-to-build-apps-for-the-cloud/

 

Introducing the Azure Developer CLI (azd): A faster way to build apps for the cloud

Introducing the public preview of the Azure Developer CLI—a new, open-source tool that accelerates the time it takes to get started on Azure. The Azure Developer CLI provides developer-friendly commands that map to key stages in your workflow: code, buil

devblogs.microsoft.com

https://learn.microsoft.com/ko-kr/azure/developer/azure-developer-cli/get-started?tabs=localinstall&pivots=programming-language-csharp

 

Azure 개발자 CLI 사용 시작

Node.js용 템플릿을 사용하여 Azure Developer CLI를 시작하는 방법을 알아봅니다.

learn.microsoft.com

 

반응형