Dependency Injection Confusion
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
### Type of issue
Missing information
### Description
This might not be the best place for this but `UseFunctionInvocation()` caused me to run around in circles for a bit in combination with the lack of documentation addressing Dependency Injection, particularly in regards to tool calls.
Using `UseFunctionInvocation()` causes the root SP to be "captured" so `IServiceProvider` on tool call methods does not get injected with the _scoped_ SP even if you pass it into the Agent constructor. There is a subtle(?) bit in the documentation on that constructor suggestion the SP provided is useless unless it needs to add an Invoking client..
I'm have no recommendations on the best way to clear things up; my head is still spinning from diving into everything today 😆
### Page URL
https://learn.microsoft.com/en-us/dotnet/ai/quickstarts/use-function-calling
### Content source URL
https://github.com/dotnet/docs/blob/main/docs/ai/quickstarts/use-function-calling.md
### Document Version Independent Id
7228f348-6649-a87d-bae5-4a70817c03bb
### Platform Id
5a517f05-b64b-c471-b99d-72253c213be1
### Article author
@gewarren
### Metadata
* ID: 27e2bbca-36b0-3883-11f7-321c044ee29a
* PlatformId: 5a517f05-b64b-c471-b99d-72253c213be1
* Service: **dotnet**
* Sub-service: **intelligent-apps**
[Related Issues](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+7228f348-6649-a87d-bae5-4a70817c03bb)
Contributor guide
Assessment
This issue has not been assessed yet.