Package: judini
Judini Python PackageThe Judini Python library provides convenient access to CodeGPT's Judini REST API from any Python 3.7+ application. The library includes type definitions for all requests parameters and response fields, and offers synchronous and asynchronous clients.DocumentationThe API documentation can be foundHere.InstallTo install the package, simply run the following command:pipinstalljudiniHow to get your keysCreate an account athttps://app.codegpt.coGet yourCodeGPT Api KeyandOrg IDfrom theApikeys menuHow to useChat CompletionfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)AGENT_ID="0000000-0000-0000-0000-000000000000"messages=[{"role":"user","content":"What is the meaning of life?"}]# No streamingchat=codegpt.chat_completion(agent_id=AGENT_ID,messages=messages)print(chat)# Streamingforchunkincodegpt.chat_completion(agent_id=AGENT_ID,...messages=messages,...stream=True):print(chunk,end="")AgentsList all agentsfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)codegpt.get_agents()>>[Agent(id='0000000-0000-0000-0000-000000000000',...),>>Agent(id='0000000-0000-0000-0000-000000000001',...)]Get agent by IDfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)agent=codegpt.get_agent(agent_id='0000000-0000-0000-0000-000000000000')agent>>Agent(id='0000000-0000-0000-0000-000000000000',>>name='Agent name',model='gpt-3.5-turbo',>>prompt='You are a helpful assistant.',>>welcome='Hello, how can I help you?',>>...)Create AgentfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)codegpt.create_agent(name='Agent name',model='gpt-3.5-turbo',...prompt='You are a helpful assistant.',...welcome='Hello, how can I help you?')>>Agent(id='0000000-0000-0000-0000-000000000000',>>name='Agent name',model='gpt-3.5-turbo',...)Update Agent infofromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)codegpt.update_agent(agent_id='0000000-0000-0000-0000-000000000000',...name='Agent name updated',...model='gpt-4-turbo-preview')>>Agent(id='0000000-0000-0000-0000-000000000000',>>name='Agent name updated',model='gpt-3.5-turbo',...)Update Agent documentsfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)codegpt.update_agent_documents(agent_id='0000000-0000-0000-0000-000000000000',...document_ids=[DOCUMENT_ID_1,DOCUMENT_ID_2])>>"Agent documents updated successfully"Delete AgentfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)codegpt.delete_agent('0000000-0000-0000-0000-000000000000')>>"Agent deleted successfully"DocumentsList all documentsfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)codegpt.get_documents()>>[Document(id='0000000-0000-0000-0000-000000000000',...),>>Document(id='0000000-0000-0000-0000-000000000001',...)]Get document by IDfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)document=codegpt.get_document_by_id('0000000-0000-0000-0000-000000000000')document>>Document(id='0000000-0000-0000-0000-000000000000',>>user_id='...',>>name='My Document',>>metadata='...',>>content='Document content',...)Upload a documentCurrently, only text documents are supportedfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)codegpt.upload_document('path/to/file.txt',generate_metadata=False)>>{'id':'0000000-0000-0000-0000-000000000000'}Update document metadatafromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)codegpt.update_document_metadata(id='0000000-0000-0000-0000-000000000000',...title='My Document Updated',)>>"Document metadata updated successfully"Delete a documentfromjudiniimportCodeGPTPluscodegpt=CodeGPTPlus(api_key=CODEGPT_API_KEY,org_id=ORG_ID)codegpt.delete_document('0000000-0000-0000-0000-000000000000')>>"Document deleted successfully"MORE EXAMPLESYou can review more examples in ourCookbook RepositoryChangelogChangelog