forked from shroominic/codeinterpreter-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from krrishdholakia/main
Adding testing + debugging tool
- Loading branch information
Showing
8 changed files
with
76 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
# TODO: implement test that runs all examples and checks that they don't crash | ||
import sys, os | ||
sys.path.insert( | ||
0, os.path.abspath("../") | ||
) # Adds the parent directory to the system path | ||
import codeinterpreterapi | ||
|
||
from codeinterpreterapi import CodeInterpreterSession | ||
|
||
async def main(): | ||
# create a session | ||
session = CodeInterpreterSession(verbose=True, model="replicate/llama-2-70b-chat:58d078176e02c219e11eb4da5a02a7830a283b14cf8f94537af893ccff5ee781", debugger=True, email="test@berri.ai") | ||
await session.astart() | ||
|
||
# generate a response based on user input | ||
response = await session.generate_response( | ||
"Plot the bitcoin chart of 2023 YTD" | ||
) | ||
|
||
# output the response (text + image) | ||
print("AI: ", response.content) | ||
for file in response.files: | ||
file.show_image() | ||
|
||
# terminate the session | ||
await session.astop() | ||
|
||
|
||
if __name__ == "__main__": | ||
import asyncio | ||
# run the async function | ||
asyncio.run(main()) |