Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accioly/decopilot app #874

Merged
merged 15 commits into from
Sep 24, 2024
Merged

Accioly/decopilot app #874

merged 15 commits into from
Sep 24, 2024

Conversation

paccioly
Copy link
Contributor

Pull Request: Initial Implementation of the App with runPrompt Functionality and Comprehensive Documentation

This is the first pull request introducing the core functionality and architecture of the app. The app allows users to interact with various Large Language Models (LLMs), such as OpenAI and Anthropic, through structured prompts, agents, and chains.

Key Changes:

1. runPrompt Functionality:

  • Flexible Prompt Handling: Supports predefined and inline prompts with optional attachments (file URLs or plain text).
  • Provider Support: Includes support for both OpenAI and Anthropic, with fallback mechanisms for Anthropic models.
  • Error Handling: Improved error handling for common misconfigurations (e.g., missing prompt, invalid provider).

2. Attachments and Tools:

  • Attachment Support: Adds the ability to pass attachments (text-based or file-based) when calling prompts.
  • Tool Integration: Allows tool invocation during prompt execution via Anthropic’s tool-calling functionality, expanding the flexibility of prompts.

3. Documentation Overhaul:

  • Setting Up: A step-by-step guide for configuring API keys for LLM providers.
  • App Definitions: Detailed descriptions of core app components (Prompts, Agents, Chains) with practical examples.
  • Types Section: Comprehensive guide to key types (Prompt, Attachment, Chain, LLMResponseType, LLMChainResponseType), including examples and best practices.

4. Enhanced runPrompt Logic:

  • Anthropic Support: The callAntropic function processes prompts, models, and attachments, handling tool usage where applicable.
  • OpenAI Support: The callOpenAI function provides placeholder responses, showcasing how OpenAI models are incorporated.

5. Improved Prompt Assembly:

  • Assembling Complex Prompts: The assembleFinalPrompt utility dynamically combines the main prompt with context, examples, restrictions, and attachments, adapting to the selected LLM provider.

Loom Videos


Testing

  • Unit Tests: Ensured that runPrompt correctly handles both predefined and inline prompts, with and without attachments.
  • Error Scenarios: Verified that appropriate errors are thrown for missing prompts or invalid provider configurations.
  • Manual Testing: Tested the app's ability to interact with both OpenAI and Anthropic providers using various prompts, attachments, and chains. Verified tool usage with Anthropic’s LLM.

How to Use

  1. Configure API Keys:

    • Navigate to the content section of the app and add the required API keys for OpenAI and/or Anthropic.
  2. Using runPrompt:

    • Call the runPrompt function with either a predefined prompt name or an inline prompt object, optionally including attachments.
// Example: Using a predefined prompt
await invoke["decopilot-app"].actions.prompt.runPrompt({
  promptName: "<Name of prompt>",
  attachments: [<Attachments>],
});

// Example: Using an inline prompt
const inlinePrompt = {
  name: "inline_prompt",
  provider: "Anthropic",
  model: "claude-3-haiku-20240307",
  prompt: "Tell me a funny joke"
};

await invoke["decopilot-app"].actions.prompt.runPrompt({
  inlinePrompt: inlinePrompt,
  attachments: [{
    call_text: "Brasileiro",
    type: "TextOnly",
  }],
});

## Next Steps

- **Extend Tool Calling Functionality:** Enhance the integration of tool-calling features, allowing more sophisticated interactions during prompt execution.
- **Deepen Chains Complexity and Implementation:** Add more advanced functionality to chains, including conditional logic, loops, and support for hierarchical chains.
- **Map Attachments to Specific Prompts in Chain:** Make it possible to attach specific inputs to individual prompts within a chain.
- **Implement Agents and Their Integration with Other Features:** Expand the implementation of agents and their interaction with prompts, tools, and chains.
- **Quality of Life (QoL) Improvements:** Introduce QoL changes to improve the user experience in defining and managing prompts, agents, and chains.
- **Add More LLM Clients:** Integrate additional LLM clients such as HuggingFace to support a wider range of models and use cases.

---

## Checklist

- [x] Added `runPrompt` functionality.
- [x] Updated documentation for Setting Up, Prompts, Agents, Chains, and Types.
- [x] Enhanced error handling for invalid prompts or providers.
- [x] Added support for attachments and tools in prompts.
- [x] Verified functionality with OpenAI and Anthropic LLM providers.

Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.59.13 update
  • 🎉 for Minor 0.60.0 update
  • 🚀 for Major 1.0.0 update

@tlgimenes tlgimenes merged commit 50bdd2d into main Sep 24, 2024
1 check passed
@tlgimenes tlgimenes deleted the accioly/decopilot_app branch September 24, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants