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

fix: properly structure completions in Ollama provider #589

Merged
merged 11 commits into from
Dec 17, 2024

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Dec 17, 2024

🔍 Review Summary

Purpose

  • Refine the structure of completion objects to ensure consistent and error-free data structure.
  • Enhance the robustness of appending content.

Key Changes

Refactor

  • Refactored the completion object initialization to include role, content, tool_calls, and function_call keys.
  • Updated event tracking to use self._safe_record() consistently.

Enhancement

  • Adjusted logic to append content to the completion object, ensuring consistent data structure.
  • Improved session handling across all provider methods.

Impact

  • Improves overall code reliability and consistency of completion objects.
  • Leads to more error-free data structures.
  • Ensures proper event tracking in both streaming and non-streaming modes.

Link to Devin run: https://app.devin.ai/sessions/cb30c1672fa04a8c8b721754f9fb3611

Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Add "(aside)" to your comment to have me ignore it.

Copy link

Walkthrough

Final Walkthrough

The recent update in the Ollama provider focuses on refining the structure of completion objects. By initializing these objects with specific keys such as 'role', 'content', 'tool_calls', and 'function_call', the update ensures a consistent and error-free data structure. Additionally, minor logic adjustments enhance the robustness of appending content to these objects, improving overall code reliability.

Changes

File(s) Summary
agentops/llms/providers/ollama.py Refactored the completion object initialization to include 'role', 'content', 'tool_calls', and 'function_call' keys. Adjusted logic to append content to the completion object, ensuring consistent data structure.

🔗 Related PRs

  • [Docs] Update and clean existing docs for better readability #558: The update improves the readability and structure of the integrations documentation, adds new pages for various AI providers, and enhances example notebooks for better developer experience.
  • Reorganize Dependencies and CI packaging #540: The update introduces a new [dependency-groups] to comply with PEP 735, moves the tach package to a ci group, and adjusts the tach-check GitHub action for CI dependencies, while ensuring the CI workflow runs successfully.
  • version bump #546: The pull request on GitHub details a description of changes made and the tests performed to validate those changes.
  • deps: remove packaging; unpinned & ranged versioning #561: The pull request addresses multiple issues by clarifying dependency management for packaging, restoring psutil's loosened dependency, and capping all dependencies to the latest stable versions for security and performance reasons.
Instructions

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @bot + *your message*
Example: @bot Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @bot + *feedback*
Example: @bot Do not comment on `save_auth` function !

Execute a command using the format:

@bot + */command*

Example: @bot /updateCommit

Available Commands:

  • /updateCommit ✨: Apply the suggested changes and commit them (or Click on the Github Action button to apply the changes !)
  • /updateGuideline 🛠️: Modify an existing guideline.
  • /addGuideline ➕: Introduce a new guideline.

Tips for Using @bot Effectively:

  • Specific Queries: For the best results, be specific with your requests.
    🔍 Example: @bot summarize the changes in this PR.
  • Focused Discussions: Tag @bot directly on specific code lines or files for detailed feedback.
    📑 Example: @bot review this line of code.
  • Managing Reviews: Use review comments for targeted discussions on code snippets, and PR comments for broader queries about the entire PR.
    💬 Example: @bot comment on the entire PR.

Need More Help?

📚 Visit our documentation for detailed guides on using Entelligence.AI.
🌐 Join our community to connect with others, request features, and share feedback.
🔔 Follow us for updates on new features and improvements.

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
agentops/llms/providers/ollama.py 0.00% 9 Missing ⚠️
Flag Coverage Δ
unittests 54.01% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
agentops/llms/providers/ollama.py 24.69% <0.00%> (-0.63%) ⬇️

devin-ai-integration bot and others added 4 commits December 17, 2024 08:33
Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
devin-ai-integration bot and others added 5 commits December 17, 2024 08:53
Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
Co-Authored-By: Alex Reibman <meta.alex.r@gmail.com>
@areibman areibman merged commit c3fceb1 into main Dec 17, 2024
10 of 11 checks passed
@areibman areibman deleted the devin/1734423873-fix-ollama-completions branch December 17, 2024 09:36
@areibman
Copy link
Contributor

Good job Devin

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