-
-
Notifications
You must be signed in to change notification settings - Fork 147
[Platform] Add FailoverPlatform
#1126
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
Failover platformFailoverPlatform
03b2077 to
2216da4
Compare
2216da4 to
2d71028
Compare
d3d5e17 to
9408d98
Compare
|
Well, that's a weird one, no changes on my side and the class is not found by the bundle, what the funk is this behavior? 🤔 |
|
Please rebase |
9408d98 to
0c424e9
Compare
0c424e9 to
dd990a7
Compare
| $ollamaPlatform = OllamaPlatformFactory::create(env('OLLAMA_HOST_URL'), http_client()); | ||
| $openAiPlatform = OpenAiPlatformFactory::create(env('OPENAI_API_KEY'), http_client()); | ||
|
|
||
| $platform = new FailoverPlatform([ | ||
| $ollamaPlatform, // # Ollama will fail as 'gpt-4o' is not available in the catalog | ||
| $openAiPlatform, | ||
| ], new RateLimiterFactory([ | ||
| 'policy' => 'sliding_window', | ||
| 'id' => 'failover', | ||
| 'interval' => '3 seconds', | ||
| 'limit' => 1, | ||
| ], new InMemoryStorage())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| $ollamaPlatform = OllamaPlatformFactory::create(env('OLLAMA_HOST_URL'), http_client()); | |
| $openAiPlatform = OpenAiPlatformFactory::create(env('OPENAI_API_KEY'), http_client()); | |
| $platform = new FailoverPlatform([ | |
| $ollamaPlatform, // # Ollama will fail as 'gpt-4o' is not available in the catalog | |
| $openAiPlatform, | |
| ], new RateLimiterFactory([ | |
| 'policy' => 'sliding_window', | |
| 'id' => 'failover', | |
| 'interval' => '3 seconds', | |
| 'limit' => 1, | |
| ], new InMemoryStorage())); | |
| $rateLimiter = new RateLimiterFactory([ | |
| 'policy' => 'sliding_window', | |
| 'id' => 'failover', | |
| 'interval' => '3 seconds', | |
| 'limit' => 1, | |
| ], new InMemoryStorage())); | |
| // Ollama will fail as 'gpt-4o' is not available in the catalog | |
| $platform = new FailoverPlatform([ | |
| OllamaPlatformFactory::create(env('OLLAMA_HOST_URL', http_client()), | |
| OpenAiPlatformFactory::create(env('OPENAI_API_KEY'), http_client()), | |
| ], $rateLimiter); |
| Message::ofUser('Tina has one brother and one sister. How many sisters do Tina\'s siblings have?'), | ||
| )); | ||
|
|
||
| echo $result->asText().\PHP_EOL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can we "assert"/be sure that openAi platform was used in the end?
|
Please rebase |
This platform was a POC that I launched a few weeks ago locally (mostly for
OllamaandOpenAIas a backup in a context of another POC -more on the other one if I find time to finish the tests-), not totally convinced by the current implementation but debates can lead to improvements so here it is 😅PS: No configuration for now as the
options.phpmust be improved on my side to handle the platforms.