{"id":23412515,"url":"https://github.com/codeastra2/chatgptdevfriendly","last_synced_at":"2025-04-12T03:42:34.424Z","repository":{"id":151795795,"uuid":"623472931","full_name":"codeastra2/ChatGPTDevFriendly","owner":"codeastra2","description":"A wrapper over the Chatgpt Python APIs,  for better developer experience. ","archived":false,"fork":false,"pushed_at":"2023-04-19T07:32:27.000Z","size":135,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T08:07:35.471Z","etag":null,"topics":["api","chatgpt","chatgpt-api","chatgpt-api-wrapper","chatgpt-bot","chatgpt-python","chatgpt-sdk","gpt3","gpt4-api","nlp","openai-api","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeastra2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-04T12:49:22.000Z","updated_at":"2024-01-17T14:29:08.000Z","dependencies_parsed_at":"2023-06-25T20:53:37.670Z","dependency_job_id":null,"html_url":"https://github.com/codeastra2/ChatGPTDevFriendly","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeastra2%2FChatGPTDevFriendly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeastra2%2FChatGPTDevFriendly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeastra2%2FChatGPTDevFriendly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeastra2%2FChatGPTDevFriendly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeastra2","download_url":"https://codeload.github.com/codeastra2/ChatGPTDevFriendly/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514221,"owners_count":21116899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","chatgpt","chatgpt-api","chatgpt-api-wrapper","chatgpt-bot","chatgpt-python","chatgpt-sdk","gpt3","gpt4-api","nlp","openai-api","python"],"created_at":"2024-12-22T18:16:14.166Z","updated_at":"2025-04-12T03:42:34.406Z","avatar_url":"https://github.com/codeastra2.png","language":"Python","readme":"# ChatGPTDevFriendly\n\n\nThis package can be used by developers to quickly develop ChatGPT applications with the robustness \nand boilerplate code being taken care of by this wrapper.\n\n## Requirements \n`pip install chatgptdevfriendly`\n\n## Usage \n\nAll the source code is currently in `src` directory and also in `tests` with sample usage in `test_main.py`. You will need an [OpenAI key](https://platform.openai.com/account/api-keys\n) to use this. \n\n```python\n\nfrom chatgptdevfriendly.v1 import ChatGptSmartClient\n\nchatgpt_client = ChatGptSmartClient(openai_api_key, model_name)\n# We can query with some previous context and also decide whether to add a prompts answer to the context\nprompt=\"List the top 10 upcoming startups in India?\"\nresponse, response_id = chatgpt_client.query(prompt, w_context=True, add_to_context=True)\nprint(f\"The answer from ChatGPT is {response}\")\n\n# We build on previous context but do not add the current prompts answer to context\nprompt=\"Ok thanks, can you give me the valuation of these startups in tabular format\"\nresponse  = chatgpt_client.query(prompt, w_context=True, add_to_context=False)\n...\n\n```\n\n## Features\n\n\n- [x] Save Conversations to a file\n- [x] Resume conversations by loading context from a file. \n- [x] Retry logic in case of API failures.\n- [x] Regular Trimming of context to 4000 tokens so that limit of 4097 is not breached. \n- [x] Total token and token vs time metric. \n\n\n- Retries: This is incase of failures like connection based request exceptions, API errors.\n```\n    (openai) C:\\Users\\Srinivas\\OneDrive\\Desktop\\StartupSearchGPT\\tests\u003epython test_main.py\n    Error occurred: API error , please try later\n    Retrying after 3 seconds...\n    Error occurred: API error , please try later\n    Retrying after 6 seconds...\n    Error occurred: API error , please try later\n    Retrying after 12 seconds...\n    Error occurred: API error , please try later\n``` \n- Context trimming: Context is trimmed as needed when the limit breaches 4000 tokens. \n![Trimming and printing metrics](printed_metrics.png)\n\n- Tracking metrics such as average time per response and total token usage.\n```\n    04-10-2023 10:26:44 | INFO | The time taken for this response is : 7.85 seconds\n\n    04-10-2023 10:34:34 | INFO | The total tokens used up-till now is: 665\n    04-10-2023 10:34:34 | INFO | The average response time is: 10.28 sec\n```\n![Sample response times graph](response_time_grp.png)\n\n```python\n    chatgpt_client.print_metrics()\n```\n- Erasing Context: We can erase all previous chat history to star from fresh.\n```python\n    chatgpt_client.erase_history()\n```\n- Rollback: we can rollback to a particular Chatresponse context to an restart from there.\n```python\n    chatgpt_client.rollback_conversation(response_id)\n```\n\n- Embeddings: We can get the query embeddings and cache them for further use. (In developement)\n```python\n    chatgpt_client.get_embeddings()\n```\n\n## Contributions\n\nThis project is meant to make the chatgpt developer life easy, so please do add any featues you feel is needed! Also if you fnd it useful please leave a star!! \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeastra2%2Fchatgptdevfriendly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeastra2%2Fchatgptdevfriendly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeastra2%2Fchatgptdevfriendly/lists"}