Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to build, deploy a RAG application usig lan...

How to build, deploy a RAG application usig langgraph(streamlit on Cloud run)

Google AI Agent 実践集中コースのLTにて発表した資料です。

[summary]
社内のアプリケーションを構築する際に、RAGがよく利用されます。しかし、RAGアプリケーションを構築・運用するにあたってはいくつか考慮点がございます。例えば、コンテナアプリケーションとして、Cloud runにデプロイする場合は、そのステートレス性を考慮する必要があります。本セッションでは、問い合わせ業務にLanggraphを用いたRAGを適用した実例を元に、RAGアプリケーションを構築・運用する際のTipsをご紹介します。最後にはデモをお見せいたします。

[Youtube]
https://youtu.be/d6A4VnyZTk4

Avatar for YutaTokita

YutaTokita

June 11, 2025
Tweet

Other Decks in Programming

Transcript

  1. How to build, deploy a RAG application using langgraph (on

    Cloud Run with Streamlit) Yuta Tokia
  2. Module agenda • How combine your data with the LLMs

    • Use case : Proposal system • Tips1 : Metadata Filtering • Tips2 : Store vector store in GCS • Explore demo!
  3. How combine your data with the LLMs? RAG 1. R(Retrieval)

    : search for relevant data from vector databases 2. A(Augmented) : add it to the prompt context 3. G(Generation) : for use in Gen AI Add external data to the LLMs! Can answer questions about specific source information.
  4. Use Case : Proposal System AI Branch Head office Person

    in charge Departments ①Propose ideas for works ②Checking , Allocating ③Answer Use AI agent Staff
  5. Use Case : Proposal System AI Tasks 1. Is this

    one a duplicate? 2. Which department should handle it? Use Langgraph for orchestration!
  6. class GraphState(BaseModel): query : str = Field(..., description = "ユーザーからのクエリー")

    category : str = Field(..., description = "提案、要望のカテゴリー") generation: Optional[str] = None documents: List[str] = Field(default_factory=list) duplicate_NO: Optional[int] = None duplicate_documents: Optional[str] = None duplicate_reason: List[str] = Field(default_factory=list) responsible_departments: List[str] = Field(default_factory=list) responsible_reason: List[str] = Field(default_factory=list) referenced_No: Optional[int] = None Using Langgraph… Can build fully customizable agent workflows
  7. Tips1 Applying Metadata Filtering(Chroma) ・Chroma supports filtering queries by metadata.

    def _retrieve(self, state : GraphState) -> dict[str, Any]: documents = retriever.invoke(state.query, filter = {“カテゴリー ” : {“$eq” : state.category}} ) Return {“documents” : format_docs(documents)}
  8. Tips2 : Store vector store in GCS Keep the vector

    store up-to-date! Easy to operate! Container(CI/CD)? blob? or