Commit Graph

268 Commits

Author SHA1 Message Date
Víctor Mayoral Vilches c75c272f36 Made local models work by switching into litellm python APIs
Still some issues with stream versions which needs further
investigation

Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-29 20:17:42 +01:00
Víctor Mayoral Vilches 859799c9f4 CLI responding, but only to proprietary models
Need to investigate why self-hosted models via OLLAMA fail API-wise

Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-28 09:48:16 +01:00
Víctor Mayoral Vilches 27d5316a60 Fix paths in docs
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-28 08:35:25 +01:00
Víctor Mayoral Vilches ba25c5234f Address error while streaming
[Error occurred during streaming: 1 validation error for ResponseUsage
input_tokens_details
  Input should be a valid dictionary or instance of InputTokensDetails [type=model_type, input_value=InputTokensDetails(prompt...ens=17, cached_tokens=0), input_type=InputTokensDetails]
    For further information visit https://errors.pydantic.dev/2.10/v/model_type]
Location: Traceback (most recent call last):
  File /Users/alias/Alias/research/openai-agents-python/src/cai/cli.py, line 209, in process_streamed_response
    async for event in result.stream_events():
  File /Users/alias/Alias/research/openai-agents-python/src/cai/sdk/agents/result.py, line 186, in stream_events
    raise self._stored_exception
  File /Users/alias/Alias/research/openai-agents-python/src/cai/sdk/agents/run.py, line 539, in _run_streamed_impl
    turn_result = await cls._run_single_turn_streamed(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File /Users/alias/Alias/research/openai-agents-python/src/cai/sdk/agents/run.py, line 641, in _run_single_turn_streamed
    async for event in model.stream_response(
  File /Users/alias/Alias/research/openai-agents-python/src/cai/sdk/agents/models/openai_chatcompletions.py, line 421, in stream_response
    ResponseUsage(
  File /Users/alias/Alias/research/openai-agents-python/env/lib/python3.12/site-packages/pydantic/main.py, line 214, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for ResponseUsage
input_tokens_details
  Input should be a valid dictionary or instance of InputTokensDetails [type=model_type, input_value=InputTokensDetails(prompt...ens=17, cached_tokens=0), input_type=InputTokensDetails]
    For further information visit https://errors.pydantic.dev/2.10/v/model_type

Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-28 08:35:11 +01:00
Víctor Mayoral Vilches 82054a2e1c Fix docs
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-28 07:55:41 +01:00
Víctor Mayoral Vilches 7b1d89db78 Advanced aligning agents but various missing bits:
- agents can't translate directly it seems, see current error
- in addition, it appears streaming mode leads to other problems

Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-27 19:36:58 +01:00
Víctor Mayoral Vilches a45f1fb22f Add blue team agent
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-27 15:14:35 +01:00
Víctor Mayoral Vilches 21d3f78ff5 Add tools, prompts and agents
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-27 15:06:12 +01:00
Víctor Mayoral Vilches 34a7bad920 Re-structure under sdk/agents, get CLI mockup
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-27 14:31:38 +01:00
Víctor Mayoral Vilches 5e15abd4d7 Minor changes for alignment
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-26 18:55:21 +01:00
Víctor Mayoral Vilches c64f35eda6 Update docs to integrate CAI, minor refinements
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-26 12:41:45 +01:00
Víctor Mayoral Vilches b12b9fe036 Adapt litellm example
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-24 19:49:51 +01:00
Víctor Mayoral Vilches 722601045b Initial re-structuring towards CAI
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-24 19:47:41 +01:00
Víctor Mayoral Vilches 3344d317ff Fix error in example path
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-24 19:47:13 +01:00
Víctor Mayoral Vilches 0113e901d2 Remove independent and isolated model tests
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-24 18:43:46 +01:00
Víctor Mayoral Vilches bf8c8d96d8 Restore structure and place litellm integraton under model_providers
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-24 18:39:17 +01:00
Víctor Mayoral Vilches b47498d891 Update openai library version to avoid version-related issue
In particular:
Traceback (most recent call last):
  File /Users/alias/Alias/research/openai-agents-python/examples/agent_patterns/litellm.py, line 4, in <module>
    from agents import OpenAIChatCompletionsModel,Agent,Runner
  File /Users/alias/Alias/research/openai-agents-python/src/agents/__init__.py, line 44, in <module>
    from .models.openai_chatcompletions import OpenAIChatCompletionsModel
  File /Users/alias/Alias/research/openai-agents-python/src/agents/models/openai_chatcompletions.py, line 57, in <module>
    from openai.types.responses.response_usage import InputTokensDetails, OutputTokensDetails
ImportError: cannot import name 'InputTokensDetails' from 'openai.types.responses.response_usage' (/Users/alias/Alias/research/openai-agents-python/env/lib/python3.12/site-packages/openai/types/responses/response_usage.py). Did you mean: 'OutputTokensDetails'?

Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-24 18:11:38 +01:00
Víctor Mayoral Vilches 6d198e8513 Merge branch 'main' of https://github.com/openai/openai-agents-python 2025-03-24 17:26:49 +01:00
Víctor Mayoral Vilches cec4dbe54a Add some additional bits to README.md
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
2025-03-24 17:26:11 +01:00
Rohan Mehta a34f34dc2e
chore: ignore PyCharm .idea/ directory (#317)
Uncomment .idea/ directory in .gitignore to ensure PyCharm IDE project
configuration files are excluded from version control.
2025-03-24 10:08:07 -04:00
madroid e96e364f08
chore: ignore PyCharm .idea/ directory
Uncomment .idea/ directory in .gitignore to ensure PyCharm IDE
project configuration files are excluded from version control.
2025-03-24 18:30:14 +08:00
Rohan Mehta 4cb011c4d2
Fix Typos (#258)
Noticed a bunch of typos when reading code, fixing.
2025-03-23 20:28:14 -04:00
Rohan Mehta 8282bc6369
Improve tracing error messages (#311)
1. Make it clear it's non-fatal
2. Make it clear it's a tracing error
2025-03-23 18:19:45 -04:00
Rohan Mehta 668fac0f74 Improve tracing error messages 2025-03-23 18:14:10 -04:00
Rohan Mehta 791a6f6812
Update quickstart.md 2025-03-23 17:56:55 -04:00
Rohan Mehta ca49991fe8
Update issues.yml 2025-03-23 12:19:07 -04:00
Rohan Mehta 8d906f88f0
Fix code examples in voice pipeline quickstart docs (#277) 2025-03-21 21:44:14 -04:00
Raduan77 ab0d940f19 revert src/ change per request 2025-03-22 01:06:01 +01:00
Rohan Mehta 486b4e87e5
[docs] fix annotation numbering in context management (#293)
Fix inconsistent numbering between code and explanatory annotations in
the context management documentation.
2025-03-21 19:33:30 -04:00
Rohan Mehta 136e2b49ba
Fix circular dependency in voice streamed example by renaming agents #291 (#292)
Fix circular dependency in voice streamed example by renaming agents.py
to my_workflow.py

Fix circular dependency in voice streamed example by renaming agents
#291
2025-03-21 19:33:12 -04:00
Aviral Garg fdf340495b Fix circular dependency in voice streamed example with cleaner import pattern 2025-03-21 16:26:19 -07:00
Aviral Garg 9473c788ba Fix type-checking for circular dependency in voice streamed example 2025-03-21 16:18:04 -07:00
Rohan Mehta 2439032f4c
Add Weights & Biases to tracing docs (#294) 2025-03-21 17:59:54 -04:00
Rohan Mehta f4f0b85eb5
Read tracing API data lazily (#289) 2025-03-21 17:58:10 -04:00
Scott Condron 13eca63732
Add Weights & Biases to tracing docs 2025-03-21 21:37:54 +00:00
Han Hwang Lim d56047be51 fix annotation numbering in context management
Fix inconsistent numbering between code and explanatory annotations in
the context management documentation.
2025-03-21 21:10:30 +00:00
Aviral Garg 7432347a94 Fix circular dependency in voice streamed example by renaming agents.py to my_workflow.py 2025-03-21 13:25:46 -07:00
Dmitry Pimenov 211ffb28c5
fix line in guardrails doc (#290) 2025-03-21 13:00:18 -07:00
James Hills fa1c3f40a1
fix line in guardrails 2025-03-21 15:58:34 -04:00
Rohan Mehta c0794a90ec Read tracing API data lazily 2025-03-21 15:32:37 -04:00
Rohan Mehta 090e79bdf4
Replace remaining uses of `fetch_ordered_spans` and `fetch_traces` for stronger tests (#288)
Following https://github.com/openai/openai-agents-python/pull/261
2025-03-21 13:25:43 -04:00
Alex Hall dacbb9ba44 More fetch_normalized_spans 2025-03-21 18:31:06 +02:00
Alex Hall 6b509e33f6 empty assertions 2025-03-21 18:26:04 +02:00
Rohan Mehta 1d3d1ce3f7
Create py.typed (#285)
- Ensure library is properly typehinted
2025-03-21 12:19:48 -04:00
Alex Hall a00b61f355 More fetch_normalized_spans 2025-03-21 18:15:52 +02:00
Alex Hall 153f703211 More fetch_normalized_spans 2025-03-21 18:14:59 +02:00
Alex Hall 7581696b38 More fetch_normalized_spans 2025-03-21 18:13:04 +02:00
Alex Hall cb0eb8e254 More fetch_normalized_spans 2025-03-21 18:09:19 +02:00
Richie Caputo b5305810d7
Create py.typed
- Ensure library is properly typehinted
2025-03-21 11:16:24 -04:00
Rohan Mehta cd9b9ab28d
Remove redundant weaker tracing assertions (#261)
Following up on https://github.com/openai/openai-agents-python/pull/25,
this removes uses of `fetch_traces` and `fetch_ordered_spans` where
there's already a stronger assertion using `fetch_normalized_spans`.
This is to help move towards the stronger style as much as possible,
since people are still adding weaker assertions such as
[this](7a0ca7930e/tests/test_concurrency.py (L59-L61))
in https://github.com/openai/openai-agents-python/pull/91. The next step
will be to find remaining uses of `fetch_ordered_spans` that can be
replaced.
2025-03-21 10:31:41 -04:00