한국 고객들이 잘 활용할 수 있도록 영상을 제작하고, 활용 방법 설명


환경구축

  1. RAG 구조를 위한 데이터 구축 (Wikipedia 샘플 활용)
    1. Azure OpenAI Studio 리소스 생성 및 테스트
    2. Blob Storage 리소스 생성
    3. Azure AI Search 구성
    4. Add your data로 구성 테스트
  2. CodeSpace를 이용한 Prompt Flow 환경 구축
    1. CodeSpace 소개
    2. Prompt Flow 사전 세팅(5분 정도 소요됨)
    3. Prompt Flow 소개, AI Studio 소개
    4. Azure OpenAI 연결


샘플 설명

  1. Web Classification


시나리오 기반 설명

  1. 수집중


Prompt Flow 실습 환경 만들기 (4월 2일까지)


Prompt Flow Fork 떠서 아래 내용으로 수정하여 문서 작성하기. (4월 1일)


3개의 패키지 추가 필요, 0.2.4 부터 VectorDB가 안나옴.

requirements.txt
pip install keyrings.alt
pip install bs4
pip install promptflow-vectordb==0.2.3



search_result_filtering
from promptflow import tool


# The inputs section will change based on the arguments of the tool function, after you save the code
# Adding type to arguments and return value will help the system show the types properly
# Please update the function name/signature per need
@tool
def my_python_tool(search_result: dict):
    # print(search_result[0]['original_entity']['text'])
    # 검색된 여러개의 문서에서 original_entity의 text 부분만 배열로 만들어서 반환
    return [entity['original_entity']['text'] for entity in search_result]
    



# 참고
@tool
def generate_prompt_context(search_result: List[dict]) -> str:
    def format_doc(doc: dict):
        return f"Content: {doc['Content']}\nSource: {doc['Source']}"

    SOURCE_KEY = "source"
    URL_KEY = "url"

    retrieved_docs = []
    for item in search_result:

        entity = SearchResultEntity.from_dict(item)
        content = entity.text or ""

        source = ""
        if entity.metadata is not None:
            if SOURCE_KEY in entity.metadata:
                if URL_KEY in entity.metadata[SOURCE_KEY]:
                    source = entity.metadata[SOURCE_KEY][URL_KEY] or ""

        retrieved_docs.append({
            "Content": content,
            "Source": source
        })
    doc_string = "\n\n".join([format_doc(doc) for doc in retrieved_docs])
    return doc_string



generate_answer
system:
Summary result for question in Korean.
Never use your knowledge and only use the text displayed in ```.
If the question asks for a comparison, display it as a table.

user:
question: {{question}}
search_results: 
```
{% for item in search_results %}
{{item}}  
{% endfor %}
```



# system:
You are a chatbot having a conversation with a human.
Given the following extracted parts of a long document and a question, create a final answer with references ("SOURCES").
If you don't know the answer, just say that you don't know. Don't try to make up an answer.
ALWAYS return a "SOURCES" part in your answer.

{{contexts}}

# user:
{{question}}



RAG 시나리오 고민중.

  1. PF 설정
  2. PF 기반으로 Embedding API 만들기
  3. 배치를 통해 임베딩 데이터 생성
  4. 검색엔진에 임베딩 데이터 인덱싱
  5. 인덱싱 정보를 활용한 검색 API 생성 활용
  6. 검색 데이터 추가하여 검색 정보 확인




  • 레이블 없음