Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

untested fix: make .models() call not crash if created or owned_by are missing in some endpoints (openrouter) #332

Merged

Conversation

thiswillbeyourgithub
Copy link
Contributor

@thiswillbeyourgithub thiswillbeyourgithub commented Apr 29, 2024

Q A
Bug fix? yes
New feature? no
BC breaks? not sure
Related Issue Fix #331

Describe your change

This change was suggested by GPT-4 as I don't know Kotlin. Moreover I don't know how openai-kotlin was engineered so I don't know if that breaks backward compatibility or if some parts of the lib rely on the fields created and owned-by to exist.

What problem is this fixing?

In issue #331 I reported that listing models fails with the endpoint of openrouter because those two keys are missing. To me supporting openrouter.ai would really be awesome because they support many many many models including from OpenAI, Anthropic, Cohere, Mistral, Google, etc. So even the bare minimum amount of compatibility (listing models, calling completion etc) would go a really long way in terms of how much flexibility that would give to your lib!

Edit: here's a typical output from curl https://openrouter.ai/api/v1/models |jq:

    {
      "id": "cohere/command-r-plus",
      "name": "Cohere: Command R+",
      "description": "Command R+ is a new, 104B-parameter LLM from Cohere. It's useful for roleplay, general consumer usecases, and Retrieval Augmented Generation (RAG).\n\nIt offers multilingual support for ten key languages to facilitate global business operations. See benchmarks and the launch post [here](https://txt.cohere.com/command-r-plus-microsoft-azure/).\n\nUse of this model is subject to Cohere's [Acceptable Use Policy](https://docs.cohere.com/docs/c4ai-acceptable-use-policy).",
      "pricing": {
        "prompt": "0.000003",
        "completion": "0.000015",
        "image": "0",
        "request": "0"
      },
      "context_length": 128000,
      "architecture": {
        "modality": "text",
        "tokenizer": "Cohere",
        "instruct_type": null
      },
      "top_provider": {
        "max_completion_tokens": 4000,
        "is_moderated": false
      },
      "per_request_limits": null
    }

So indeed the owned_by and created fields don't exist, but I don't know if those extra fields like "pricing" would cause a crash or not.

@thiswillbeyourgithub thiswillbeyourgithub changed the title untested fix: make .models() call not crash if created or owned_by are missing untested fix: make .models() call not crash if created or owned_by are missing in some endpoints (openrouter) Apr 29, 2024
Copy link
Owner

@aallam aallam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks for your contribution!

@aallam aallam merged commit ad9bfe8 into aallam:main Apr 29, 2024
@coolbeevip
Copy link

When might be able to release this version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: endpoint openrouter fails because the output is missing Fields[created, owned_by]
3 participants