-
Notifications
You must be signed in to change notification settings - Fork 1.5k
XaiModel with tests and stock analysis agent #3400
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
base: main
Are you sure you want to change the base?
Conversation
|
@brightsparc Thanks Julian! Let me know when this is ready for review or if you have any questions. |
|
Due to using otel in our own SDK, I did notice an error when running the pydantic ai code in async.io loop: We could disable our tracing with |
@brightsparc Looks like grok-4-fast is not on https://github.com/pydantic/genai-prices/blob/main/prices/providers/x_ai.yml yet. Contribution welcome! (See contrib docs) Failing tests: I believe we just need to add the xAI env var to the list here: pydantic-ai/tests/test_examples.py Lines 179 to 182 in c096d99
This one should be fixed by running Looks like we need the new
Do you have example code for me that triggers it? |
I will make a separate PR here
Added this:
Not sure I follow this
You can run the following command to repo that error: |
This PR includes support for
GrokModelwhich uses the xai-sdk-python library, which supports chat completion, tool calling, and built-in server side tool calls.I have included a series of tests, as well as an example for a stock analysis agent that uses search and code execution, and returns results in the form of a local tool call.
Below is what the output looks like in logfire. It includes custom spans emmited from the xai-sdk.
Cost is coming back as Unknown so it would be good to understand how we can populate this.