mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-07 07:08:31 +00:00
* ruff linted * using native sdks with litellm fallback * drop exa * drop print on completion * Refactor LLM and utility functions for type consistency - Updated `max_tokens` parameter in `LLM` class to accept `float` in addition to `int`. - Modified `create_llm` function to ensure consistent type hints and return types, now returning `LLM | BaseLLM | None`. - Adjusted type hints for various parameters in `create_llm` and `_llm_via_environment_or_fallback` functions for improved clarity and type safety. - Enhanced test cases to reflect changes in type handling and ensure proper instantiation of LLM instances. * fix agent_tests * fix litellm tests and usagemetrics fix * drop print * Refactor LLM event handling and improve test coverage - Removed commented-out event emission for LLM call failures in `llm.py`. - Added `from_agent` parameter to `CrewAgentExecutor` for better context in LLM responses. - Enhanced test for LLM call failure to simulate OpenAI API failure and updated assertions for clarity. - Updated agent and task ID assertions in tests to ensure they are consistently treated as strings. * fix test_converter * fixed tests/agents/test_agent.py * Refactor LLM context length exception handling and improve provider integration - Renamed `LLMContextLengthExceededException` to `LLMContextLengthExceededExceptionError` for clarity and consistency. - Updated LLM class to pass the provider parameter correctly during initialization. - Enhanced error handling in various LLM provider implementations to raise the new exception type. - Adjusted tests to reflect the updated exception name and ensure proper error handling in context length scenarios. * Enhance LLM context window handling across providers - Introduced CONTEXT_WINDOW_USAGE_RATIO to adjust context window sizes dynamically for Anthropic, Azure, Gemini, and OpenAI LLMs. - Added validation for context window sizes in Azure and Gemini providers to ensure they fall within acceptable limits. - Updated context window size calculations to use the new ratio, improving consistency and adaptability across different models. - Removed hardcoded context window sizes in favor of ratio-based calculations for better flexibility. * fix test agent again * fix test agent * feat: add native LLM providers for Anthropic, Azure, and Gemini - Introduced new completion implementations for Anthropic, Azure, and Gemini, integrating their respective SDKs. - Added utility functions for tool validation and extraction to support function calling across LLM providers. - Enhanced context window management and token usage extraction for each provider. - Created a common utility module for shared functionality among LLM providers. * chore: update dependencies and improve context management - Removed direct dependency on `litellm` from the main dependencies and added it under extras for better modularity. - Updated the `litellm` dependency specification to allow for greater flexibility in versioning. - Refactored context length exception handling across various LLM providers to use a consistent error class. - Enhanced platform-specific dependency markers for NVIDIA packages to ensure compatibility across different systems. * refactor(tests): update LLM instantiation to include is_litellm flag in test cases - Modified multiple test cases in test_llm.py to set the is_litellm parameter to True when instantiating the LLM class. - This change ensures that the tests are aligned with the latest LLM configuration requirements and improves consistency across test scenarios. - Adjusted relevant assertions and comments to reflect the updated LLM behavior. * linter * linted * revert constants * fix(tests): correct type hint in expected model description - Updated the expected description in the test_generate_model_description_dict_field function to use 'Dict' instead of 'dict' for consistency with type hinting conventions. - This change ensures that the test accurately reflects the expected output format for model descriptions. * refactor(llm): enhance LLM instantiation and error handling - Updated the LLM class to include validation for the model parameter, ensuring it is a non-empty string. - Improved error handling by logging warnings when the native SDK fails, allowing for a fallback to LiteLLM. - Adjusted the instantiation of LLM in test cases to consistently include the is_litellm flag, aligning with recent changes in LLM configuration. - Modified relevant tests to reflect these updates, ensuring better coverage and accuracy in testing scenarios. * fixed test * refactor(llm): enhance token usage tracking and add copy methods - Updated the LLM class to track token usage and log callbacks in streaming mode, improving monitoring capabilities. - Introduced shallow and deep copy methods for the LLM instance, allowing for better management of LLM configurations and parameters. - Adjusted test cases to instantiate LLM with the is_litellm flag, ensuring alignment with recent changes in LLM configuration. * refactor(tests): reorganize imports and enhance error messages in test cases - Cleaned up import statements in test_crew.py for better organization and readability. - Enhanced error messages in test cases to use `re.escape` for improved regex matching, ensuring more robust error handling. - Adjusted comments for clarity and consistency across test scenarios. - Ensured that all necessary modules are imported correctly to avoid potential runtime issues.
188 lines
7.2 KiB
YAML
188 lines
7.2 KiB
YAML
interactions:
|
|
- request:
|
|
body: '{"messages": [{"role": "system", "content": "You are test role. test backstory\nYour
|
|
personal goal is: test goal\nTo give my best complete final answer to the task
|
|
respond using the exact following format:\n\nThought: I now can give a great
|
|
answer\nFinal Answer: Your final answer must be the great and the most complete
|
|
as possible, it must be outcome described.\n\nI MUST use these formats, my job
|
|
depends on it!"}, {"role": "user", "content": "\nCurrent Task: Calculate 2 +
|
|
2\n\nThis is the expect criteria for your final answer: The result of the calculation\nyou
|
|
MUST return the actual complete content as the final answer, not a summary.\n\nBegin!
|
|
This is VERY important to you, use the tools available and give your best Final
|
|
Answer, your job depends on it!\n\nThought:"}], "model": "gpt-4o-mini", "stop":
|
|
["\nObservation:"]}'
|
|
headers:
|
|
accept:
|
|
- application/json
|
|
accept-encoding:
|
|
- gzip, deflate
|
|
connection:
|
|
- keep-alive
|
|
content-length:
|
|
- '833'
|
|
content-type:
|
|
- application/json
|
|
host:
|
|
- api.openai.com
|
|
user-agent:
|
|
- OpenAI/Python 1.59.6
|
|
x-stainless-arch:
|
|
- arm64
|
|
x-stainless-async:
|
|
- 'false'
|
|
x-stainless-lang:
|
|
- python
|
|
x-stainless-os:
|
|
- MacOS
|
|
x-stainless-package-version:
|
|
- 1.59.6
|
|
x-stainless-raw-response:
|
|
- 'true'
|
|
x-stainless-retry-count:
|
|
- '0'
|
|
x-stainless-runtime:
|
|
- CPython
|
|
x-stainless-runtime-version:
|
|
- 3.12.7
|
|
method: POST
|
|
uri: https://api.openai.com/v1/chat/completions
|
|
response:
|
|
content: "{\n \"id\": \"chatcmpl-AoJqi2nPubKHXLut6gkvISe0PizvR\",\n \"object\":
|
|
\"chat.completion\",\n \"created\": 1736556064,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n
|
|
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
|
|
\"assistant\",\n \"content\": \"I now can give a great answer \\nFinal
|
|
Answer: The result of the calculation 2 + 2 is 4.\",\n \"refusal\": null\n
|
|
\ },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n
|
|
\ ],\n \"usage\": {\n \"prompt_tokens\": 161,\n \"completion_tokens\":
|
|
25,\n \"total_tokens\": 186,\n \"prompt_tokens_details\": {\n \"cached_tokens\":
|
|
0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n
|
|
\ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
|
|
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
|
|
\"default\",\n \"system_fingerprint\": \"fp_bd83329f63\"\n}\n"
|
|
headers:
|
|
CF-Cache-Status:
|
|
- DYNAMIC
|
|
CF-RAY:
|
|
- 9000dbe81c55bf7f-ATL
|
|
Connection:
|
|
- keep-alive
|
|
Content-Encoding:
|
|
- gzip
|
|
Content-Type:
|
|
- application/json
|
|
Date:
|
|
- Sat, 11 Jan 2025 00:41:05 GMT
|
|
Server:
|
|
- cloudflare
|
|
Set-Cookie:
|
|
- __cf_bm=LCNQO7gfz6xDjDqEOZ7ha3jDwPnDlsjsmJyScVf4UUw-1736556065-1.0.1.1-2ZcyBDpLvmxy7UOdCrLd6falFapRDuAu6WcVrlOXN0QIgZiDVYD0bCFWGCKeeE.6UjPHoPY6QdlEZZx8.0Pggw;
|
|
path=/; expires=Sat, 11-Jan-25 01:11:05 GMT; domain=.api.openai.com; HttpOnly;
|
|
Secure; SameSite=None
|
|
- _cfuvid=cRATWhxkeoeSGFg3z7_5BrHO3JDsmDX2Ior2i7bNF4M-1736556065175-0.0.1.1-604800000;
|
|
path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None
|
|
Transfer-Encoding:
|
|
- chunked
|
|
X-Content-Type-Options:
|
|
- nosniff
|
|
access-control-expose-headers:
|
|
- X-Request-ID
|
|
alt-svc:
|
|
- h3=":443"; ma=86400
|
|
openai-organization:
|
|
- crewai-iuxna1
|
|
openai-processing-ms:
|
|
- '1060'
|
|
openai-version:
|
|
- '2020-10-01'
|
|
strict-transport-security:
|
|
- max-age=31536000; includeSubDomains; preload
|
|
x-ratelimit-limit-requests:
|
|
- '30000'
|
|
x-ratelimit-limit-tokens:
|
|
- '150000000'
|
|
x-ratelimit-remaining-requests:
|
|
- '29999'
|
|
x-ratelimit-remaining-tokens:
|
|
- '149999810'
|
|
x-ratelimit-reset-requests:
|
|
- 2ms
|
|
x-ratelimit-reset-tokens:
|
|
- 0s
|
|
x-request-id:
|
|
- req_463fbd324e01320dc253008f919713bd
|
|
http_version: HTTP/1.1
|
|
status_code: 200
|
|
- request:
|
|
body: '{"trace_id": "110f149f-af21-4861-b208-2a568e0ec690", "execution_type":
|
|
"crew", "user_identifier": null, "execution_context": {"crew_fingerprint": null,
|
|
"crew_name": "Unknown Crew", "flow_name": null, "crewai_version": "0.193.2",
|
|
"privacy_level": "standard"}, "execution_metadata": {"expected_duration_estimate":
|
|
300, "agent_count": 0, "task_count": 0, "flow_method_count": 0, "execution_started_at":
|
|
"2025-09-23T20:49:30.660760+00:00"}}'
|
|
headers:
|
|
Accept:
|
|
- '*/*'
|
|
Accept-Encoding:
|
|
- gzip, deflate
|
|
Connection:
|
|
- keep-alive
|
|
Content-Length:
|
|
- '436'
|
|
Content-Type:
|
|
- application/json
|
|
User-Agent:
|
|
- CrewAI-CLI/0.193.2
|
|
X-Crewai-Version:
|
|
- 0.193.2
|
|
method: POST
|
|
uri: http://localhost:3000/crewai_plus/api/v1/tracing/batches
|
|
response:
|
|
body:
|
|
string: '{"error":"bad_credentials","message":"Bad credentials"}'
|
|
headers:
|
|
Content-Length:
|
|
- '55'
|
|
cache-control:
|
|
- no-cache
|
|
content-security-policy:
|
|
- 'default-src ''self'' *.crewai.com crewai.com; script-src ''self'' ''unsafe-inline''
|
|
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts https://www.gstatic.com
|
|
https://run.pstmn.io https://share.descript.com/; style-src ''self'' ''unsafe-inline''
|
|
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts; img-src ''self''
|
|
data: *.crewai.com crewai.com https://zeus.tools.crewai.com https://dashboard.tools.crewai.com
|
|
https://cdn.jsdelivr.net; font-src ''self'' data: *.crewai.com crewai.com;
|
|
connect-src ''self'' *.crewai.com crewai.com https://zeus.tools.crewai.com
|
|
https://connect.useparagon.com/ https://zeus.useparagon.com/* https://*.useparagon.com/*
|
|
https://run.pstmn.io https://connect.tools.crewai.com/ ws://localhost:3036
|
|
wss://localhost:3036; frame-src ''self'' *.crewai.com crewai.com https://connect.useparagon.com/
|
|
https://zeus.tools.crewai.com https://zeus.useparagon.com/* https://connect.tools.crewai.com/
|
|
https://www.youtube.com https://share.descript.com'
|
|
content-type:
|
|
- application/json; charset=utf-8
|
|
permissions-policy:
|
|
- camera=(), microphone=(self), geolocation=()
|
|
referrer-policy:
|
|
- strict-origin-when-cross-origin
|
|
server-timing:
|
|
- cache_read.active_support;dur=0.04, cache_fetch_hit.active_support;dur=0.00,
|
|
cache_read_multi.active_support;dur=0.06, start_processing.action_controller;dur=0.00,
|
|
process_action.action_controller;dur=1.86
|
|
vary:
|
|
- Accept
|
|
x-content-type-options:
|
|
- nosniff
|
|
x-frame-options:
|
|
- SAMEORIGIN
|
|
x-permitted-cross-domain-policies:
|
|
- none
|
|
x-request-id:
|
|
- efa34d51-cac4-408f-95cc-b0f933badd75
|
|
x-runtime:
|
|
- '0.021535'
|
|
x-xss-protection:
|
|
- 1; mode=block
|
|
status:
|
|
code: 401
|
|
message: Unauthorized
|
|
version: 1
|