kyegomez / tree-of-thoughts

Plug in and Play Implementation of Tree of Thoughts: Deliberate Problem Solving with Large Language Models that Elevates Model Reasoning by atleast 70%
https://discord.gg/qUtxnK2NMf
Apache License 2.0
4.18k stars 353 forks source link

Add openai env options; Add example script #6

Closed yhyu13 closed 1 year ago

yhyu13 commented 1 year ago

1, Allow users to quickly adjust API key, base url, model using env variables. For example, startup different instances using docker with different .env, etc 2, Add example script from readme to repo 3, Add ReAct prompts as an option 4, Add chat completion api/response support for gpt4/chagpt, and rate limiter exception handle as well

yhyu13 commented 1 year ago

Let me know if you have any question about this pr

kyegomez commented 1 year ago

Thanks for contributing 😊

Hey it looks great but I published an all-new release and it might conflict with some of the commits you've made, I added in additional params to the solve method of treeofthoughts can you double check and see if there are any conflicts and then submit with all of your changes?

yhyu13 commented 1 year ago

Thanks for contributing blush

Hey it looks great but I published an all-new release and it might conflict with some of the commits you've made, I added in additional params to the solve method of treeofthoughts can you double check and see if there are any conflicts and then submit with all of your changes?

Sure thing. It looks fine for now

yhyu13 commented 1 year ago

Added chat completion support for https://github.com/kyegomez/tree-of-thoughts/issues/7

Sample output from my console:

Using custom api_base https://api.openai-asia.com/v1
Using api_model gpt-4
Generated thoughts: ['Observation: Current large language models rely heavily on pattern recognition and statistical correlations to generate text, lacking a deeper understanding of the underlying logic and reasoning.\n\nThoughts: Next generation reasoning methods for large language models could involve incorporating more structured knowledge representation and', 'Observation: Current large language models rely heavily on pattern matching and statistical associations to generate responses, which may not always lead to coherent or accurate reasoning.\n\nThoughts: To improve reasoning capabilities in next-generation large language models, we should explore incorporating knowledge', 'Observation: Large Language Models have shown promising results in natural language understanding and generation, but there is still room for improvement in terms of reasoning capabilities.\n\nThoughts: To enhance next-generation reasoning methods for Large Language Models, we could explore incorporating structured', 'Observation: Large Language Models (LLMs) have shown impressive performance in natural language understanding and generation tasks, but they still face limitations in terms of reasoning and generalization abilities.\n\nThoughts: To improve the reasoning capabilities of LLMs,', 'Observation: Large Language Models (LLMs) like GPT-3 have shown impressive performance in various tasks, but they still struggle with systematic reasoning and generalization.\n\nThoughts: One possible direction for next-generation reasoning methods in LLMs']
Value text 0.85
value: 0.85
Value text 0.9
value: 0.9
Value text 0.8
value: 0.8
Value text 0.75
value: 0.75
Value text 0.75
value: 0.75
触发限流,请减少调用频率, sleep for 30s, set it by env OPENAI_RATE_TIMEOUT

The output meets expectations? @kyegomez

I don't have write access at this moment, would you like to merge this pr as you see fit? Thanks! Full change : https://github.com/kyegomez/tree-of-thoughts/pull/6#issue-1719964451