chat2query package¶
Chat2Query Python SDK
- class chat2query.Chat2QueryClient(api_key, base_url='http://localhost:5000')[source]¶
Bases:
objectClient for interacting with the Chat2Query API.
- Parameters:
api_key (
str) – Your Chat2Query API keybase_url (
str) – Base URL for the API (default: http://localhost:5000)
- class chat2query.DatabaseResource(client)[source]¶
Bases:
objectManage database connections
- list()[source]¶
List all databases.
- Return type:
List[Dict[str,Any]]- Returns:
List of database objects
- get(database_id)[source]¶
Get a specific database.
- Parameters:
database_id (
int) – Database ID- Return type:
Dict[str,Any]- Returns:
Database object
- create(name, database_uri, description=None)[source]¶
Create a new database connection.
- Parameters:
name (
str) – Database namedatabase_uri (
str) – Database connection URIdescription (
Optional[str]) – Optional description
- Return type:
Dict[str,Any]- Returns:
Created database object
- class chat2query.ChatResource(client)[source]¶
Bases:
objectManage chat sessions
- list(database_id)[source]¶
List all chats for a database.
- Parameters:
database_id (
int) – Database ID- Return type:
List[Dict[str,Any]]- Returns:
List of chat objects
- get(database_id, chat_id)[source]¶
Get a specific chat.
- Parameters:
database_id (
int) – Database IDchat_id (
int) – Chat ID
- Return type:
Dict[str,Any]- Returns:
Chat object
- class chat2query.MessageResource(client)[source]¶
Bases:
objectManage chat messages
- class chat2query.Chat2QueryService(api_key, base_url=None)[source]¶
Bases:
objectLightweight service for integrating with the Chat2Query backend via application API keys.
The service pings the backend on initialization to verify the key and cache the user id.
- DEFAULT_BASE_URL = 'https://chat2query.com'¶
- exception chat2query.APIError(message, status_code=None)[source]¶
Bases:
Chat2QueryErrorRaised when API returns an error
- exception chat2query.AuthenticationError[source]¶
Bases:
Chat2QueryErrorRaised when authentication fails
- exception chat2query.NotFoundError(message, status_code=None)[source]¶
Bases:
APIErrorRaised when a resource is not found
- exception chat2query.ValidationError[source]¶
Bases:
Chat2QueryErrorRaised when request validation fails
- chat2query.hello_world()[source]¶
Returns a hello world message.
- Returns:
Hello world message
- Return type:
str
Submodules¶
chat2query.client module¶
Chat2Query SDK Client
- class chat2query.client.Chat2QueryClient(api_key, base_url='http://localhost:5000')[source]¶
Bases:
objectClient for interacting with the Chat2Query API.
- Parameters:
api_key (
str) – Your Chat2Query API keybase_url (
str) – Base URL for the API (default: http://localhost:5000)
- class chat2query.client.DatabaseResource(client)[source]¶
Bases:
objectManage database connections
- list()[source]¶
List all databases.
- Return type:
List[Dict[str,Any]]- Returns:
List of database objects
- get(database_id)[source]¶
Get a specific database.
- Parameters:
database_id (
int) – Database ID- Return type:
Dict[str,Any]- Returns:
Database object
- create(name, database_uri, description=None)[source]¶
Create a new database connection.
- Parameters:
name (
str) – Database namedatabase_uri (
str) – Database connection URIdescription (
Optional[str]) – Optional description
- Return type:
Dict[str,Any]- Returns:
Created database object
- class chat2query.client.ChatResource(client)[source]¶
Bases:
objectManage chat sessions
- list(database_id)[source]¶
List all chats for a database.
- Parameters:
database_id (
int) – Database ID- Return type:
List[Dict[str,Any]]- Returns:
List of chat objects
- get(database_id, chat_id)[source]¶
Get a specific chat.
- Parameters:
database_id (
int) – Database IDchat_id (
int) – Chat ID
- Return type:
Dict[str,Any]- Returns:
Chat object
- class chat2query.client.MessageResource(client)[source]¶
Bases:
objectManage chat messages
chat2query.exceptions module¶
Chat2Query SDK Exceptions
- exception chat2query.exceptions.Chat2QueryError[source]¶
Bases:
ExceptionBase exception for Chat2Query SDK
- exception chat2query.exceptions.AuthenticationError[source]¶
Bases:
Chat2QueryErrorRaised when authentication fails
- exception chat2query.exceptions.APIError(message, status_code=None)[source]¶
Bases:
Chat2QueryErrorRaised when API returns an error
- exception chat2query.exceptions.NotFoundError(message, status_code=None)[source]¶
Bases:
APIErrorRaised when a resource is not found
- exception chat2query.exceptions.ValidationError[source]¶
Bases:
Chat2QueryErrorRaised when request validation fails
chat2query.service module¶
Service helper for Chat2Query application API key integrations.
- class chat2query.service.Chat2QueryService(api_key, base_url=None)[source]¶
Bases:
objectLightweight service for integrating with the Chat2Query backend via application API keys.
The service pings the backend on initialization to verify the key and cache the user id.
- DEFAULT_BASE_URL = 'https://chat2query.com'¶
-
user_id:
Optional[int]¶