CoCo CLI workflow examples
CoCo CLI workflow examples (워크플로 예시)
이 주제는 일반적인 작업에 대한 워크플로 예시를 제공해 CoCo CLI를 최대한 활용하게 해줘요. 데이터 발견, 합성 데이터 생성, 대시보드 구축, Cortex Agents 만들기를 다뤄요.
본문
사용 사례: 데이터 발견과 쿼리
이 섹션은 합성 데이터셋을 만들고 기본 분석을 수행해 대시보드를 생성하는 과정을 안내해요.
Snowflake 계정 연결
cortex -c <your-demo-account>
또는 대화형으로 연결:
> connect to <my demo account>
데이터 발견·탐색
데이터 카탈로그를 검색하고, 계보를 이해하고, 관련 테이블을 찾아요.
> Find all tables related to customers that I have write access to
올바른 역할·권한 확인
> What privileges does my role have on this database?
접근 문제를 진단하고 역할 권한을 이해해요.
> Why am I getting a permissions error?
합성 데이터 생성
서로 다른 사용 사례를 위한 합성 데이터 생성 예시들이에요.
핀테크 회사의 사기 분석:
> Generate realistic looking synthetic data into <database name>. Create a table of 10000
financial transactions where ~0.5% of them are fraudulent. Include Amount, Location,
Merchant, and Time. Make the fraudulent ones look suspicious based on location or amount.
제약 임상 시험 데이터:
> Make a dummy dataset for a clinical trial of a new blood pressure medication. List 100
patients, their age, their dosage group (Placebo vs. 10mg), and their blood pressure
readings over 4 weeks.
고객 이탈 데이터:
> Create a customer churn dataset for a telecom company showing customer usage for 100000
customers. Include basic demographic data such as fake names, phone numbers, US city and
state. Also include data usage (GB), call minutes, contract length, and whether they
cancelled their service (churn). Ensure there's a customer_id column that's unique.
Create the data locally and then upload it to Snowflake.
이 데이터에 대한 기본 쿼리 수행
> Calculate the Churn Rate grouped by state and contract length. Order the results by the
highest churn rate first so I can see the most risky regions and contract types.
> I want to identify the heaviest data users who are also churning.
대화형 대시보드 구축
차트, 필터, 상호작용이 있는 Streamlit 앱을 만들고 배포해요.
팁
마음에 드는 예시 대시보드를 열고(또는 온라인에서 찾고) 클립보드에 복사해요. 이미지를 CoCo에 직접 붙여넣을 수 있어요(Ctrl+V) 디자인 참조로요.
> Build an interactive Streamlit dashboard on this data with state filters and use the
conversation so far for examples of the kinds of charts to show. Use the attached image
as a template for visuals and branding.
대시보드가 잘 동작하고 멋지게 보이는지 확인한 뒤 Snowflake에 업로드해요.
> Ensure that the Streamlit app will work with Snowflake and upload it to Snowflake.
Give me a link to access the dashboard when it's done.
축하해요! 이제 내가 만든 데이터셋을 표시하는 동작하는 Streamlit 대시보드가 있어요.
사용 사례: Cortex Agents 구축
이 섹션은 Snowflake CoWork에서 데이터에 대한 질문에 답하는 Cortex Agent를 만드는 과정을 안내해요. 기존 합성 데이터를 고객 통화 대화록으로 보강할 거예요.
Cortex Analyst용 Semantic View 만들기
데이터에 Cortex Analyst를 사용할 수 있도록 시맨틱 뷰를 만들어요. 물어보는 모든 질문에 기본값을 사용해요.
> Write a Semantic View named DEMO_TELECOM_CHURN_ANALYTICS for Cortex Analyst based on
this data. Use the semantic-view optimization skill.
Cortex Search 서비스 만들기
먼저 고객 서비스 통화를 담은 합성 데이터를 생성해요.
> Generate a new table called customer_call_logs. Generate 50 realistic customer service
transcripts (2-3 sentences each) as PDF files. Some should be angry complaints about
coverage, others should be questions about billing. Then use the AI_PARSE_DOCUMENT
function to extract the text and layout information from the PDFs into the TRANSCRIPT_TEXT
column. Split text into chunks for better search quality.
그런 다음 대화록을 색인하는 Cortex Search 서비스를 만들어요.
> Create a Cortex Search Service named CALL_LOGS_SEARCH that indexes these transcripts.
It should index the TRANSCRIPT_TEXT column and filter by CUSTOMER_ID.
Cortex Agent 만들기
Analyst와 Search 서비스 둘 다를 사용하는 Cortex Agent를 만들어요.
> Build a Cortex Agent that has access to two tools:
- cortex_analyst: For querying the TELECOM_CUSTOMERS SQL table.
- cortex_search: For searching the CALL_LOGS_SEARCH service.
Write a system prompt for this agent:
- Persona: You are a Senior Retention Specialist.
- Routing Logic: If the user asks for 'metrics', 'counts', or 'averages', use the
Analyst tool. If the user asks for 'sentiment', 'reasons', or 'summaries of calls',
use the Search tool.
- Output Format: Always verify the customer ID before answering. If the risk score is
high, end the response with a recommended retention offer (e.g., 'Offer 10% discount').
- Constraint: Never reveal the raw CHURN_RISK_SCORE to the user; interpret it as 'Low',
'Medium', or 'High'.
Snowflake CoWork에 배포
에이전트를 Snowflake CoWork에 배포해요.
> Let's deploy this agent to Snowflake CoWork.
축하해요! Snowflake CoWork 에이전트를 성공적으로 만들고 배포했어요.
이제 Snowflake CoWork에서 이 에이전트에 접근해 다음과 같은 질문을 할 수 있어요.
- "고객이 통화에서 무엇을 불평하고 있나요?"
- "월 요금이 100달러를 넘는 고위험 고객을 보여줘"
더 알아보기
- CoCo CLI — 설치와 첫 프롬프트로 시작하기
- Skills — 시맨틱 모델, 에이전트, 문서용 전문화된 스킬
- Cortex Analyst — Cortex Analyst 문서