Commit Graph

4 Commits

Author SHA1 Message Date
Devin AI
b1d0072c13 Fix failing tests: update expectations for new URL-as-is behavior
- Update test inputs to provide complete URLs with /api/embeddings endpoint
- Remove tests for automatic URL construction that no longer exists
- Tests now reflect the requirement for users to provide complete URLs
- Addresses CI failures after removing _construct_embeddings_url helper

Co-Authored-By: João <joao@crewai.com>
2025-07-02 17:07:33 +00:00
Devin AI
b022e06e0d Fix tests to match new URL behavior: use complete URLs as-is
- Update test expectations to provide complete URLs with /api/embeddings endpoint
- Remove assumptions about automatic URL construction per lucasgomide's feedback
- Tests now reflect the new behavior where URLs are used exactly as provided
- Maintains backward compatibility for users who provide complete URLs

Co-Authored-By: João <joao@crewai.com>
2025-07-02 17:04:27 +00:00
Devin AI
abd1d341da Address GitHub review feedback: add URL validation, helper functions, and edge case tests
- Add _validate_url() helper function with proper URL validation using urllib.parse
- Add _construct_embeddings_url() helper function to refactor URL construction logic
- Add comprehensive error handling with ValueError for invalid URLs
- Fix test mocking to use correct chromadb import path
- Add edge case tests for invalid URLs with pytest markers
- Organize tests with @pytest.mark.url_configuration and @pytest.mark.error_handling
- Remove unused imports (pytest, MagicMock) to fix lint issues

This addresses all suggestions from joaomdmoura's AI review while maintaining backward compatibility.

Co-Authored-By: João <joao@crewai.com>
2025-07-01 22:07:13 +00:00
Devin AI
d422439b7a Fix Ollama embedding configurator to respect API_BASE environment variable
- Add support for API_BASE environment variable in _configure_ollama method
- Implement priority order: url config > api_base config > API_BASE env var > default
- Handle URL construction with proper /api/embeddings endpoint appending
- Maintain backward compatibility with existing url parameter
- Add comprehensive tests covering all configuration scenarios
- Fixes issue #3099: Ollama integration problems with API_BASE configuration

The fix ensures consistent behavior with other embedding providers and
allows users to configure Ollama embeddings using environment variables
for better deployment flexibility.

Co-Authored-By: João <joao@crewai.com>
2025-07-01 22:01:45 +00:00