Skip to content

added session flow docs#238

Open
apascal07 wants to merge 3 commits intomainfrom
ap/go-session-flows
Open

added session flow docs#238
apascal07 wants to merge 3 commits intomainfrom
ap/go-session-flows

Conversation

@apascal07
Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces extensive documentation for the experimental session flow API in Genkit Go. It provides developers with a comprehensive guide to building sophisticated multi-turn conversational AI applications, detailing how to manage conversation history, state, and streaming capabilities. The new content aims to empower users to create more robust and interactive AI experiences by leveraging Genkit's advanced features for agent and sub-agent frameworks.

Highlights

  • New Documentation: Session Flows: Introduced comprehensive documentation for building multi-turn conversational AI applications using Genkit Go's experimental session flow API.
  • State Management: Detailed explanations on managing conversation state, including client-managed state and server-managed state with automatic snapshot persistence and custom store implementation.
  • Advanced Features: Guidance on using custom session state, handling artifacts, and streaming custom data for real-time updates within conversational flows.
  • Simplified Flow Definition: Covered DefineSessionFlow for full control and DefineSessionFlowFromPrompt for simplified, prompt-backed session flow creation.
  • Sidebar Navigation Update: Added a new entry to the documentation sidebar, making the 'Building multi-turn persisted flows' guide easily discoverable.
Changelog
  • src/content/docs/docs/session-flows.mdx
    • New documentation file created for session flows.
    • Detailed examples and explanations for DefineSessionFlow and DefineSessionFlowFromPrompt.
    • Sections on client-managed and server-managed state, including snapshot persistence.
    • Guidance on handling custom session state, artifacts, and streaming custom data.
  • src/sidebar.ts
    • Added a navigation link to the new session-flows.mdx document.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds comprehensive documentation for the new session flows feature in Genkit for Go. The documentation is well-structured and covers various aspects of using session flows. I've identified a couple of areas for improvement: one regarding the consistency of a label in the sidebar, and another concerning the completeness of code examples to ensure they are runnable, which will enhance the developer experience.

"github.com/firebase/genkit/go/plugins/googlegenai"
)

g := genkit.Init(ctx, genkit.WithPlugins(&googlegenai.GoogleAI{}))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ctx variable is used here without being defined, and this initialization appears at the top level, which is not valid Go. To make this code snippet runnable and consistent with other documentation examples, you should wrap this logic in a main function and initialize ctx with context.Background(). This issue is present in several other code snippets throughout this document.

Here's an example of how to structure it:

func main() {
    ctx := context.Background()
    g := genkit.Init(ctx, genkit.WithPlugins(&googlegenai.GoogleAI{}))

    chatFlow := genkit.DefineSessionFlow(g, "chat",
        // ... rest of the code
    )
}

{ label: "Implementing Agentic Patterns", slug: "docs/agentic-patterns" },
{ label: "Managing prompts with Dotprompt", slug: "docs/dotprompt" },
{ label: "Passing information through context", slug: "docs/context" },
{ label: "Building multi-turn persisted flows", slug: "docs/session-flows" },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the page title ('Building multi-turn session flows'), consider changing the label here to match.

Suggested change
{ label: "Building multi-turn persisted flows", slug: "docs/session-flows" },
{ label: "Building multi-turn session flows", slug: "docs/session-flows" },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant