Name | symposium JSON |
Version |
0.1.8
JSON |
| download |
home_page | |
Summary | Interaction of multiple language models |
upload_time | 2024-03-17 16:31:56 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.10 |
license | |
keywords |
symposium
conversations
ai
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Symposium
Interactions with multiple language models require at least a little bit of a 'unified' interface. The 'symposium' packagee is an attempt to do that. It is a work in progress and will change without notice. If you need a recording capabilities, install the `grammateus` package and pass an instance of Grammateus/recorder in your calls to connectors.
## Unification
One of the motivations for this package was the need in a unified interface for messaging language models, which is particularly useful if you want to experiment with interactions between them.
The unified standard use by this package is:
```python
messages = [
{"role": "human", "name": "alex", "content": "Can we discuss this?"},
{"role": "machine", "name": "claude", "content": "Yes."}
{"role": "human", "name": "alex", "content": "Then let's do it."}
]
```
The utility functions stored in the `adapters` sub-package transform incoming and outgoing messages of particular models from this format to a model-specific format and back from the format of its' response to it.
## Anthropic
Import:
```python
from symposium.connectors import anthropic_rest as ant
```
#### Messages
```python
messages = [
{"role": "user", "content": "Can we change human nature?"}
]
kwargs = {
"model": "claude-3-sonnet-20240229",
"system": "answer concisely",
# "messages": [],
"max_tokens": 5,
"stop_sequences": ["stop", ant.HUMAN_PREFIX],
"stream": False,
"temperature": 0.5,
"top_k": 250,
"top_p": 0.5
}
response = ant.claud_message(messages,**kwargs)
```
#### Completion
```python
prompt = "Can we change human nature?"
kwargs = {
"model": "claude-instant-1.2",
"max_tokens": 5,
# "prompt": prompt,
"stop_sequences": [ant.HUMAN_PREFIX],
"temperature": 0.5,
"top_k": 250,
"top_p": 0.5
}
response = ant.claud_complete(prompt, **kwargs)
```
## OpenAI
Import:
```python
from symposium.connectors import openai_rest as oai
```
#### Messages
```python
messages = [
{"role": "user", "content": "Can we change human nature?"}
]
kwargs = {
"model": "gpt-3.5-turbo",
# "messages": [],
"max_tokens": 5,
"n": 1,
"stop_sequences": ["stop"],
"seed": None,
"frequency_penalty": None,
"presence_penalty": None,
"logit_bias": None,
"logprobs": None,
"top_logprobs": None,
"temperature": 0.5,
"top_p": 0.5,
"user": None
}
responses = oai.gpt_message(messages, **kwargs)
```
#### Completion
```python
prompt = "Can we change human nature?"
kwargs = {
"model": "gpt-3.5-turbo-instruct",
# "prompt": str,
"suffix": str,
"max_tokens": 5,
"n": 1,
"best_of": None,
"stop_sequences": ["stop"],
"seed": None,
"frequency_penalty": None,
"presence_penalty": None,
"logit_bias": None,
"logprobs": None,
"top_logprobs": None,
"temperature": 0.5,
"top_p": 0.5,
"user": None
}
responses = oai.gpt_complete(prompt, **kwargs)
```
## Gemini
Import:
```python
from symposium.connectors import gemini_rest as gem
```
#### Messages
```python
messages = [
{
"role": "user",
"parts": [
{"text": "Human nature can not be changed, because..."},
{"text": "...and that is why human nature can not be changed."}
]
},{
"role": "model",
"parts": [
{"text": "Should I synthesize a text that will be placed between these two statements and follow the previous instruction while doing that?"}
]
},{
"role": "user",
"parts": [
{"text": "Yes, please do."},
{"text": "Create a most concise text possible, preferably just one sentence}"}
]
}
]
kwargs = {
"model": "gemini-1.0-pro",
# "messages": [],
"stop_sequences": ["STOP","Title"],
"temperature": 0.5,
"max_tokens": 5,
"n": 1,
"top_p": 0.9,
"top_k": None
}
response = gem.gemini_content(messages, **kwargs)
```
## PaLM
Import:
```python
from symposium.connectors import palm_rest as path
```
#### Completion
```python
kwargs = {
"model": "text-bison-001",
"prompt": str,
"temperature": 0.5,
"n": 1,
"max_tokens": 10,
"top_p": 0.5,
"top_k": None
}
responses = path.palm_complete(prompt, **kwargs)
```
#### Messages
```python
context = "This conversation will be happening between Albert and Niels"
examples = [
{
"input": {"author": "Albert", "content": "We didn't talk about quantum mechanics lately..."},
"output": {"author": "Niels", "content": "Yes, indeed."}
}
]
messages = [
{
"author": "Albert",
"content": "Can we change human nature?"
}, {
"author": "Niels",
"content": "Not clear..."
}, {
"author": "Albert",
"content": "Seriously, can we?"
}
]
kwargs = {
"model": "chat-bison-001",
# "context": str,
# "examples": [],
# "messages": [],
"temperature": 0.5,
# no 'max_tokens', beware the effects of that!
"n": 1,
"top_p": 0.5,
"top_k": None
}
responses = path.palm_content(context, examples, messages, **kwargs)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "symposium",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "symposium,conversations,ai",
"author": "",
"author_email": "Alexander Fedotov <alex.fedotov@aol.com>",
"download_url": "https://files.pythonhosted.org/packages/3b/90/5e0cac0013257b6ed2b80eb412a7e38fb961ac6a10d7ab418f4c53211098/symposium-0.1.8.tar.gz",
"platform": null,
"description": "# Symposium\nInteractions with multiple language models require at least a little bit of a 'unified' interface. The 'symposium' packagee is an attempt to do that. It is a work in progress and will change without notice. If you need a recording capabilities, install the `grammateus` package and pass an instance of Grammateus/recorder in your calls to connectors.\n## Unification\nOne of the motivations for this package was the need in a unified interface for messaging language models, which is particularly useful if you want to experiment with interactions between them.\n\nThe unified standard use by this package is:\n```python\nmessages = [\n {\"role\": \"human\", \"name\": \"alex\", \"content\": \"Can we discuss this?\"},\n {\"role\": \"machine\", \"name\": \"claude\", \"content\": \"Yes.\"}\n {\"role\": \"human\", \"name\": \"alex\", \"content\": \"Then let's do it.\"}\n]\n```\nThe utility functions stored in the `adapters` sub-package transform incoming and outgoing messages of particular models from this format to a model-specific format and back from the format of its' response to it.\n## Anthropic\nImport:\n```python\nfrom symposium.connectors import anthropic_rest as ant\n```\n#### Messages\n```python\nmessages = [\n {\"role\": \"user\", \"content\": \"Can we change human nature?\"}\n]\nkwargs = {\n \"model\": \"claude-3-sonnet-20240229\",\n \"system\": \"answer concisely\",\n # \"messages\": [],\n \"max_tokens\": 5,\n \"stop_sequences\": [\"stop\", ant.HUMAN_PREFIX],\n \"stream\": False,\n \"temperature\": 0.5,\n \"top_k\": 250,\n \"top_p\": 0.5\n}\nresponse = ant.claud_message(messages,**kwargs)\n```\n#### Completion\n```python\nprompt = \"Can we change human nature?\"\nkwargs = {\n \"model\": \"claude-instant-1.2\",\n \"max_tokens\": 5,\n # \"prompt\": prompt,\n \"stop_sequences\": [ant.HUMAN_PREFIX],\n \"temperature\": 0.5,\n \"top_k\": 250,\n \"top_p\": 0.5\n}\nresponse = ant.claud_complete(prompt, **kwargs)\n```\n## OpenAI\nImport:\n```python\nfrom symposium.connectors import openai_rest as oai\n```\n#### Messages\n```python\nmessages = [\n {\"role\": \"user\", \"content\": \"Can we change human nature?\"}\n]\nkwargs = {\n \"model\": \"gpt-3.5-turbo\",\n # \"messages\": [],\n \"max_tokens\": 5,\n \"n\": 1,\n \"stop_sequences\": [\"stop\"],\n \"seed\": None,\n \"frequency_penalty\": None,\n \"presence_penalty\": None,\n \"logit_bias\": None,\n \"logprobs\": None,\n \"top_logprobs\": None,\n \"temperature\": 0.5,\n \"top_p\": 0.5,\n \"user\": None\n}\nresponses = oai.gpt_message(messages, **kwargs)\n```\n#### Completion\n```python\nprompt = \"Can we change human nature?\"\nkwargs = {\n \"model\": \"gpt-3.5-turbo-instruct\",\n # \"prompt\": str,\n \"suffix\": str,\n \"max_tokens\": 5,\n \"n\": 1,\n \"best_of\": None,\n \"stop_sequences\": [\"stop\"],\n \"seed\": None,\n \"frequency_penalty\": None,\n \"presence_penalty\": None,\n \"logit_bias\": None,\n \"logprobs\": None,\n \"top_logprobs\": None,\n \"temperature\": 0.5,\n \"top_p\": 0.5,\n \"user\": None\n}\nresponses = oai.gpt_complete(prompt, **kwargs)\n```\n## Gemini\nImport:\n```python\nfrom symposium.connectors import gemini_rest as gem\n```\n#### Messages\n```python\nmessages = [\n {\n \"role\": \"user\",\n \"parts\": [\n {\"text\": \"Human nature can not be changed, because...\"},\n {\"text\": \"...and that is why human nature can not be changed.\"}\n ]\n },{\n \"role\": \"model\",\n \"parts\": [\n {\"text\": \"Should I synthesize a text that will be placed between these two statements and follow the previous instruction while doing that?\"}\n ]\n },{\n \"role\": \"user\",\n \"parts\": [\n {\"text\": \"Yes, please do.\"},\n {\"text\": \"Create a most concise text possible, preferably just one sentence}\"}\n ]\n }\n]\nkwargs = {\n \"model\": \"gemini-1.0-pro\",\n # \"messages\": [],\n \"stop_sequences\": [\"STOP\",\"Title\"],\n \"temperature\": 0.5,\n \"max_tokens\": 5,\n \"n\": 1,\n \"top_p\": 0.9,\n \"top_k\": None\n}\nresponse = gem.gemini_content(messages, **kwargs)\n```\n \n## PaLM\nImport:\n```python\nfrom symposium.connectors import palm_rest as path\n```\n#### Completion\n```python\nkwargs = {\n \"model\": \"text-bison-001\",\n \"prompt\": str,\n \"temperature\": 0.5,\n \"n\": 1,\n \"max_tokens\": 10,\n \"top_p\": 0.5,\n \"top_k\": None\n}\nresponses = path.palm_complete(prompt, **kwargs)\n```\n#### Messages\n```python\ncontext = \"This conversation will be happening between Albert and Niels\"\nexamples = [\n {\n \"input\": {\"author\": \"Albert\", \"content\": \"We didn't talk about quantum mechanics lately...\"},\n \"output\": {\"author\": \"Niels\", \"content\": \"Yes, indeed.\"}\n }\n]\nmessages = [\n {\n \"author\": \"Albert\",\n \"content\": \"Can we change human nature?\"\n }, {\n \"author\": \"Niels\",\n \"content\": \"Not clear...\"\n }, {\n \"author\": \"Albert\",\n \"content\": \"Seriously, can we?\"\n }\n]\nkwargs = {\n \"model\": \"chat-bison-001\",\n # \"context\": str,\n # \"examples\": [],\n # \"messages\": [],\n \"temperature\": 0.5,\n # no 'max_tokens', beware the effects of that!\n \"n\": 1,\n \"top_p\": 0.5,\n \"top_k\": None\n}\nresponses = path.palm_content(context, examples, messages, **kwargs)\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Interaction of multiple language models",
"version": "0.1.8",
"project_urls": {
"Bug Tracker": "https://github.com/multilogue/sumposium/issues",
"Homepage": "https://github.com/multilogue/symposium"
},
"split_keywords": [
"symposium",
"conversations",
"ai"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "389a5cab5e983c084baf854d9397379d042b2869897cfa2f5bc32c0418c2ffb9",
"md5": "68230fb043267bb44d6f97a8bfbc4022",
"sha256": "1b41dc80b68cbd59375b6c5fb53d64773287a6125f0afbaf5368fbd1c5fc6b50"
},
"downloads": -1,
"filename": "symposium-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "68230fb043267bb44d6f97a8bfbc4022",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 39685,
"upload_time": "2024-03-17T16:31:52",
"upload_time_iso_8601": "2024-03-17T16:31:52.747079Z",
"url": "https://files.pythonhosted.org/packages/38/9a/5cab5e983c084baf854d9397379d042b2869897cfa2f5bc32c0418c2ffb9/symposium-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3b905e0cac0013257b6ed2b80eb412a7e38fb961ac6a10d7ab418f4c53211098",
"md5": "1e66ff3bc31458680bac526f13ff6f46",
"sha256": "ffe62e9556432857ad27a67657fa5702dc9bbe28cfb942d5b1327afa8d23cdac"
},
"downloads": -1,
"filename": "symposium-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "1e66ff3bc31458680bac526f13ff6f46",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 22596,
"upload_time": "2024-03-17T16:31:56",
"upload_time_iso_8601": "2024-03-17T16:31:56.189225Z",
"url": "https://files.pythonhosted.org/packages/3b/90/5e0cac0013257b6ed2b80eb412a7e38fb961ac6a10d7ab418f4c53211098/symposium-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-17 16:31:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "multilogue",
"github_project": "sumposium",
"github_not_found": true,
"lcname": "symposium"
}