Commit graph

423 commits

Author SHA1 Message Date
Rohan Mehta
472e8c13bd
Docs for LiteLLM integration (#532) 2025-04-16 18:54:22 -04:00
Rohan Mehta
bd404e0f87
Litellm integration (#524)
litellm is a library that abstracts away details/differences for a lot
of model providers. Adding an extension, so that any provider can easily
be integrated.

---
[//]: # (BEGIN SAPLING FOOTER)
* #532
* __->__ #524
2025-04-16 18:48:41 -04:00
Rohan Mehta
0faadf7f7b
Show repo name/data in docs (#525)
Easy linking back to the repo, plus some social proof (stars/forks etc).
2025-04-16 14:27:23 -04:00
Rohan Mehta
65cae71b14
Extract chat completions streaming helpers (#523)
Small refactor.

---
[//]: # (BEGIN SAPLING FOOTER)
* #524
* __->__ #523
2025-04-15 18:42:09 -04:00
Rohan Mehta
80de53e879
Extract chat completions conversion code into helper (#522)
Small refactor for rest of stack.

---
[//]: # (BEGIN SAPLING FOOTER)
* #524
* #523
* __->__ #522
2025-04-15 18:31:17 -04:00
Rohan Mehta
ce1abe6006
Run CI on all commits, not just ones on main (#521)
Was not running on my stacked PRs.
2025-04-15 18:26:48 -04:00
Rohan Mehta
ca8e8bed5d
v0.0.11 (#520)
New release, to incorporate #519
2025-04-15 14:37:16 -04:00
Rohan Mehta
e625cb495e
Only include stream_options when streaming (#519)
Closes #518
2025-04-15 12:48:27 -04:00
Rohan Mehta
f329eef7e8
Examples and tests for previous_response_id (#512)
Examples + tests
2025-04-15 12:46:31 -04:00
RonaldChungHueyWu
b978b4382e
Support parallel_tool_calls=False for ChatCompletion API (#513)
The current ChatCompletion API supports only `parallel_tool_calls=True`
or `parallel_tool_calls=NOT_GIVEN`
This PR is to support setting `parallel_tool_calls=False`, a common
requirement in controlling agent tool use patterns (e.g. ensuring one
tool call at the time, to facilitate desired tool calling sequence).

I followed the merged
[PR#333](https://github.com/openai/openai-agents-python/pull/333) for
consistency.
2025-04-14 22:48:01 -04:00
Rohan Mehta
96a97af9be
v0.0.10 (#514) 2025-04-14 22:45:30 -04:00
Kazuhiro Sera
360f173b73
Evolve the doc translation workflow by using gpt-4.1 (#507)
This pull request enhances the document translation workflow by
switching to the new GPT-4.1 model. The generator script’s prompt now
includes a “workflow” section that guides the model to iterate
self-reviews on its outputs to autonomously achieve the highest quality.
This addition has noticeably improved the naturalness and consistency of
the wording in the translated outputs.
2025-04-14 22:04:07 -04:00
Rohan Mehta
92d6e3e66c
Previous response id (#509)
Allows passing in the previous_response_id to reduce sending the same
data again and again.

Test plan:
Examples. Adding tests in next PR shortly.

---
[//]: # (BEGIN SAPLING FOOTER)
* __->__ #509
* #508
2025-04-14 22:02:47 -04:00
Rohan Mehta
86ad99d798
Move dev-only deps to dev section (#506)
These two deps are only used in development/examples
2025-04-14 21:59:41 -04:00
Rohan Mehta
d6f5190d53
Replace referencable_id with response_id (#508)
Minor change - naming. So that it doesn't pollute the next PR.

---
[//]: # (BEGIN SAPLING FOOTER)
* #509
* __->__ #508
2025-04-14 21:37:18 -04:00
Daniele Morotti
e8f14da473
Fix type annotations examples (#496)
I fixed the type annotations errors for pydantic objects in some
examples as noted in #490 .

When running `make lint` the following error occurs "UP007 Use `X | Y`
for type annotations". If you know how to ignore it I will be happy to
edit the pull request, thanks.
2025-04-14 13:28:43 -04:00
Rohan Mehta
36f5b72449
Don't run tracing shutdown behavior if disabled (#503)
Towards #502
2025-04-14 12:46:00 -04:00
Rohan Mehta
5727a1c73a
Example for streaming guardrails (#505)
An example for the question in the issue attached - how to run
guardrails during streaming.

Towards #495.
2025-04-14 12:40:41 -04:00
Rohan Mehta
5183f528f4
Add docs for customizng agent-as-tool (#504)
Co-authored-by: pakrym-oai <pakrym@openai.com>
2025-04-14 12:40:32 -04:00
Kazuhiro Sera
25f97f979b
Fix typos and misspellings (#486)
Detected typos using typos-cli (https://crates.io/crates/typos-cli). It
detected "occured" in a string constant "handoff_occured" too, but I
didn't change the part this time because it could be a minor breaking
change.


Full outputs:
```
% typos .
error: `Supresses` should be `Suppresses`
  --> ./src/agents/function_schema.py:134:7
    |
134 |     # Supresses warnings about missing annotations for params
    |       ^^^^^^^^^
    |
error: `typ` should be `typo`, `type`
  --> ./src/agents/strict_schema.py:51:5
   |
51 |     typ = json_schema.get("type")
   |     ^^^
   |
error: `typ` should be `typo`, `type`
  --> ./src/agents/strict_schema.py:52:8
   |
52 |     if typ == "object" and "additionalProperties" not in json_schema:
   |        ^^^
   |
error: `typ` should be `typo`, `type`
  --> ./src/agents/strict_schema.py:55:9
   |
55 |         typ == "object"
   |         ^^^
   |
error: `occured` should be `occurred`
  --> ./src/agents/stream_events.py:34:18
   |
34 |         "handoff_occured",
   |                  ^^^^^^^
   |
error: `occured` should be `occurred`
  --> ./src/agents/_run_impl.py:723:69
    |
723 |                 event = RunItemStreamEvent(item=item, name="handoff_occured")
    |                                                                     ^^^^^^^
    |
error: `desitnation` should be `destination`
  --> ./src/agents/tracing/span_data.py:171:25
    |
171 |     Includes source and desitnation agents.
    |                         ^^^^^^^^^^^
    |
error: `exmaples` should be `examples`
  --> ./docs/scripts/translate_docs.py:71:145
   |
71 |         "* The term 'examples' must be code examples when the page mentions the code examples in the repo, it can be translated as either 'code exmaples' or 'sample code'.",
   |                                                                                                                                                 ^^^^^^^^
   |
error: `structed` should be `structured`
  --> ./tests/test_agent_hooks.py:227:16
    |
227 | async def test_structed_output_non_streamed_agent_hooks():
    |                ^^^^^^^^
    |
error: `structed` should be `structured`
  --> ./tests/test_agent_hooks.py:298:16
    |
298 | async def test_structed_output_streamed_agent_hooks():
    |                ^^^^^^^^
    |
```
2025-04-14 10:37:13 -04:00
Daniele Morotti
e04d87cb1f
Add extra request parameters extra_query and extra_body (#500)
Added the possibility to pass `extra_query` and `extra_body` parameters
when sending a request.
In this implementation I added the attributes to `ModelSettings` as
suggested by @rm-openai in #487 .

I'll be happy to add some tests if you have any suggestions.
2025-04-14 10:37:00 -04:00
LouisShark
d0693a192e
fix: ensure metadata is non-null in response handling (#483)
ensure metadata is non-null in response handling
2025-04-11 18:20:59 -04:00
Kazuhiro Sera
e115d5a459
Add model_settings guide to models document page (#484)
This is a pretty minor improvement to the docs: `model_settings`
parameter is only mentioned on the agent doc page, but first-time
visitors may want to know it’s also available on the models page.
2025-04-11 13:27:01 -04:00
Kazuhiro Sera
68c725f942
Improve translation pipeline details (#475)
This pull request improves the translation pipeline, which was
introduced by #460. Now the document generation works pretty well with
gpt-4o model.
2025-04-10 16:54:05 -04:00
Ddper
8ded8a9981
add overwrite mechanism for stream_options (#465)
fix issue https://github.com/openai/openai-agents-python/issues/442

below is an example to overwrite include_usage


```
    result = Runner.run_streamed(
        agent,
        "Write a haiku about recursion in programming.",
        run_config=RunConfig(
            model_provider=CUSTOM_MODEL_PROVIDER,
            model_settings=ModelSettings(include_usage=True)
        ),
    )
```
2025-04-10 16:54:00 -04:00
Dmitry Pimenov
84fb734ba0
Adding scope and span_data doc strings (#463)
Built docs and tested outputs locally
2025-04-09 14:59:07 -04:00
nikkie
d089886f01
examples(research_bot): Add space to INSTRUCTIONS (#439)
Thanks to awesome example `research_bot`

Fix andproduce and goodgrammar (and so on)

```python
>>> from examples.research_bot.agents import search_agent
>>> print(search_agent.INSTRUCTIONS)
You are a research assistant. Given a search term, you search the web for that term andproduce a concise summary of the results. The summary must 2-3 paragraphs and less than 300words. Capture the main points. Write succinctly, no need to have complete sentences or goodgrammar. This will be consumed by someone synthesizing a report, so its vital you capture theessence and ignore any fluff. Do not include any additional commentary other than the summaryitself.
```
2025-04-08 14:01:09 -04:00
nikkie
ccff74dcfa
docs: Make default model clear (#457)
close https://github.com/openai/openai-agents-python/issues/440
2025-04-08 11:47:23 -04:00
kanchi
869c95b012
Update computer-use example to support simultaneous key presses (#452)
### Summary

Updated the `computer-use` example to support simultaneous key presses.
The current implementation presses and releases keys one at a time,
which prevents combo inputs like copy (CTRL+C) from working correctly.

### Test plan

N/A

### Issue number

N/A

### Checks

- [ ] I've added new tests (if relevant)
- [ ] I've added/updated the relevant documentation
- [x] I've run `make lint` and `make format`
- [ ] I've made sure tests pass
2025-04-08 11:47:15 -04:00
Kazuhiro Sera
ece647b93f
Add i18n support to the documents (#460) 2025-04-08 09:41:48 -04:00
Rohan Mehta
9d3d6a58e5
v0.0.9 (#456)
bump version.
2025-04-07 19:27:19 -04:00
Rohan Mehta
2bcc864b81
Don't send the "store" param unless its hitting OpenAI (#455)
Summary: See #443. Causes issues with Gemini.

Test Plan: Tests. Also tested with Gemini to ensure it works.
2025-04-07 19:13:08 -04:00
Rohan Mehta
50bbfdd8be
Ensure MCP works when inputSchema.properties is missing (#454)
Resolves #449 - TLDR, [OpenAI's
API](https://platform.openai.com/docs/api-reference/responses/create)
expects the properties field to be present, whereas the MCP schema
explicitly allows omitting the properties field. [MCP
Spec](https://github.com/modelcontextprotocol/specification/blob/main/schema/2025-03-26/schema.json)
2025-04-07 18:38:36 -04:00
James Hills
064e25b01b
add links and mcp + voice examples (#438) 2025-04-04 19:53:12 -04:00
Rohan Mehta
0396052dcd
v0.0.8 (#432)
bump
2025-04-03 19:46:26 -04:00
Suveen Ellawela
07a627e8eb
Add reasoning parameter to ModelSettings (#388)
fixes #189 

@rm-openai Would really appreciate if this can get a quick review.

---------

Co-authored-by: Rohan Mehta <rm@openai.com>
2025-04-03 19:35:59 -04:00
Drew Youngwerth
0110f3ad96
Add metadata to ModelSettings (#431) 2025-04-03 17:50:24 -04:00
Drew Youngwerth
bef3394859
Fix reference to group id as session id (#430)
Group ID is being mistakenly referenced as Session ID, which is a bit
confusing.
2025-04-03 15:36:35 -04:00
amri369
506d73cfa4
Fix small typos and mcp example command (#417) 2025-04-03 12:34:53 -04:00
Rohan Mehta
7c2d7f4abd
Misc small fixes - mcp version, test for function_schema, version gen (#429)
Summary:
1. Use <2 for MCP version so it doesn't break if the MCP sdk upgrades.
2. Test the func schema extraction logic.
3. Fix the logic to get the version nuber of the framework

Test Plan:
unit tests
2025-04-03 12:08:01 -04:00
Rohan Mehta
bf302c574c
Use "{}" instead of empty string for arguments (#422) 2025-04-02 12:27:42 -04:00
Rohan Mehta
01f5e86ea5
Convert MCP schemas to strict where possible (#414)
## Summary:
Towards #404. I made this configurable because it's not clear this is
always a good thing to do. I also made it default to False because I'm
not sure if this could cause errors.

If it works out well, we can switch the default in the future as a small
breaking changes

## Test Plan:
Unit tests
2025-04-01 16:50:13 -04:00
Muhammad Anas Baig
45c25f8ab0
Fix Docstring Reference in 'ToolsToFinalOutputFunction' in 'agent.py' (#391)
### **Summary**
This pull request fixes docstring in `ToolsToFinalOutputFunction`, where
`ToolToFinalOutputResult` was incorrectly referenced instead of
`ToolsToFinalOutputResult`.

### **Changes Made**
- Updated the docstring of `ToolsToFinalOutputFunction` to correctly
reference `ToolsToFinalOutputResult`.

### **Before**
```python
"""A function that takes a run context and a list of tool results, and returns a
`ToolToFinalOutputResult`.
"""
```

### **After**
```python
"""A function that takes a run context and a list of tool results, and returns a
`ToolsToFinalOutputResult`.
"""
```

### **Why This Change?**
- The incorrect reference could cause confusion for developers reading
the code.
- This aligns the documentation with the actual return type of the
function.

### **Checklist**
- [x] Verify correct reference to `ToolsToFinalOutputResult`
- [x] Ensure no functionality is affected

### **Testing**
This is a documentation-only change and does not affect runtime
behavior.

### **Reviewer Notes**
- Please review for accuracy in documentation.
- No additional tests are needed since this is a non-functional change.
2025-04-01 14:09:26 -04:00
Hoc Phan
3454e3b323
Update tracing.md - Added Okahu-Monocle (#385)
Monocle is an open source tracing and eval for GenAI apps.
2025-04-01 11:57:43 -04:00
Travis Dent
db3975f06c
Fix incorrect slot name on SpeechSpanData (#386)
Slot had inconsistent name. 

`"first_byte_at"` -> `"first_content_at"`
2025-04-01 11:51:58 -04:00
Carmen(Jia) Liu
e827dfe75f
Fix: Correct the trace path in examples (#395)
### What changed?
The trace URL was using the wrong path format:
- Old: `/traces/{trace_id}`
- Fixed: `/traces/trace?trace_id={trace_id}`

<img width="781" alt="Screenshot 2025-03-30 at 5 54 11 pm"
src="https://github.com/user-attachments/assets/982fbb1d-7163-4438-b237-493e3100b5c7"
/>
2025-04-01 11:51:52 -04:00
Toufik Airane
757b7dafb1
Update README.md (#405)
fix typo
2025-04-01 11:50:40 -04:00
Ddper
8b2bc0b4ba
fix duplicate declaration of _shutdown_event (#410)
fix duplicate declaration of _shutdown_event
reported by issue
https://github.com/openai/openai-agents-python/issues/314
2025-04-01 11:48:02 -04:00
Eric Peter
9c53abe8c1
Databricks MLflow tracing integration (#401) 2025-03-30 23:53:09 -04:00
Ali Waleed
382500d841
Add Langtrace to tracing.md (#371) 2025-03-27 21:33:49 -04:00